Submission #4260421
Source Code Expand
#include <set> #include <map> #include <stack> #include <queue> #include <cmath> #include <cstdio> #include <vector> #include <bitset> #include <cstring> #include <utility> #include <iostream> #include <algorithm> #define LL long long #define Rg register #define RI register int #define RC register char #define ed puts("") #define pair pair<LL,LL> #define space putchar(' ') using namespace std; template <typename tp> inline void read(tp & x) { x=0; RI f=1; RC c=getchar(); while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar(); } while(c>='0' && c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();} x*=f; } template <typename Tp> inline void print(Tp x) { if(x<0) x=-x,putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); } int n; LL ans; LL b[100005]; struct qwq { int num; int val; bool flag; }a[100005]; inline bool cmp(qwq x,qwq y) { return x.val<y.val; } //qwq int main() { read(n); for(RI i=1;i<=n;++i) read(a[i].val),a[i].num=i; stable_sort(a+1,a+n+1,cmp); for(RI i=1;i<=n;++i) { int k=i; int kk=a[i].val; // while(k<=n) // { // if(a[i].num==k) // { // a[i].flag=1; // break; // } // k+=2; // } int h=i%2; int hh=a[i].num%2; if(h==hh) a[i].flag=1; if(a[i].flag) continue; // k=i; // while(k>=1) // { // if(a[i].num==k) // { // a[i].flag=1; // break; // } // k-=2; // } } for(RI i=1;i<=n;++i) { if(a[i].flag) continue; ans++; } if(ans==0) { print(0); return 0; } print(ans/2); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - BBuBBBlesort! |
User | vjudge4 |
Language | C++14 (Clang 3.8.0) |
Score | 600 |
Code Size | 1515 Byte |
Status | AC |
Exec Time | 25 ms |
Memory | 2688 KB |
Compile Error
./Main.cpp:25:5: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register] RI f=1; ^ ./Main.cpp:15:12: note: expanded from macro 'RI' #define RI register int ^ ./Main.cpp:26:5: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register] RC c=getchar(); ^ ./Main.cpp:16:12: note: expanded from macro 'RC' #define RC register char ^ ./Main.cpp:57:6: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register] for(RI i=1;i<=n;++i) ^ ./Main.cpp:15:12: note: expanded from macro 'RI' #define RI register int ^ ./Main.cpp:60:6: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register] for(RI i=1;i<=n;++i) ^ ./Main.cpp:15:12: note: expanded from macro 'RI' #define RI register int ^ ./Main.cpp:88:6: warning: 'register' stor...
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 600 / 600 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 24 ms | 2560 KB |
02.txt | AC | 24 ms | 2560 KB |
03.txt | AC | 25 ms | 2688 KB |
04.txt | AC | 24 ms | 2560 KB |
05.txt | AC | 21 ms | 2560 KB |
06.txt | AC | 21 ms | 2560 KB |
07.txt | AC | 21 ms | 2560 KB |
08.txt | AC | 10 ms | 2560 KB |
09.txt | AC | 10 ms | 2560 KB |
10.txt | AC | 21 ms | 2560 KB |
11.txt | AC | 22 ms | 2560 KB |
12.txt | AC | 10 ms | 2560 KB |
13.txt | AC | 10 ms | 2560 KB |
14.txt | AC | 21 ms | 2560 KB |
15.txt | AC | 21 ms | 2560 KB |
16.txt | AC | 21 ms | 2560 KB |
17.txt | AC | 21 ms | 2560 KB |
18.txt | AC | 1 ms | 256 KB |
19.txt | AC | 1 ms | 256 KB |
20.txt | AC | 1 ms | 256 KB |
21.txt | AC | 1 ms | 256 KB |
22.txt | AC | 1 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |