Submission #4260306


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;
		}
		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-1);
	return 0;
}

Submission Info

Submission Time
Task C - BBuBBBlesort!
User vjudge3
Language C++14 (Clang 3.8.0)
Score 0
Code Size 1418 Byte
Status WA
Exec Time 2107 ms
Memory 2560 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:85:6: warning: 'register' stor...

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 2
AC × 11
WA × 1
TLE × 12
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 TLE 2103 ms 2560 KB
02.txt TLE 2103 ms 2560 KB
03.txt TLE 2103 ms 2560 KB
04.txt TLE 2103 ms 2560 KB
05.txt TLE 2103 ms 2560 KB
06.txt TLE 2103 ms 2560 KB
07.txt TLE 2103 ms 2560 KB
08.txt AC 10 ms 2560 KB
09.txt AC 10 ms 2560 KB
10.txt TLE 2103 ms 2560 KB
11.txt TLE 2048 ms 2560 KB
12.txt TLE 2103 ms 2560 KB
13.txt TLE 2103 ms 2560 KB
14.txt AC 1644 ms 2560 KB
15.txt AC 1641 ms 2560 KB
16.txt TLE 2107 ms 2560 KB
17.txt WA 1672 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