Submission #94181

# Submission time Handle Problem Language Result Execution time Memory
94181 2019-01-16T12:36:47 Z AKaan37 Nizin (COCI16_nizin) C++14
0 / 100
155 ms 66560 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair<int,int> PII;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR for(lo i=1;i<=n;i++)
#define mid (start+end)/2

const lo mod = 1000000007;
const lo li = 100000001;
const lo inf = 1000000000;
const lo MAX = 1000000000000000000;
const lo MIN = -1000000000000000000;
const lo LOG = 30;

lo n,m,cev,a[li],oo,ama,kk,vis[li],gogo,nono;
//~ vector<lo> v;
lo nov;

int main(){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
	}
	FOR{
		if(i>n/2) break;
		if(vis[i]==1) continue;
		for(int u=n;u>=1;u--){
			if(vis[u]==0) nov=u;
			break;
		}
		while(a[i]!=a[nov]){
			vis[i]=1;
			vis[nov]=1;
			if(a[i]>a[nov]){
				gogo++;
				a[nov]+=a[nov-gogo];
				vis[nov-gogo]=1;
				oo++;
			}
			if(a[i]<a[nov]){
				nono++;
				a[i]+=a[i+nono];
				vis[i+nono]=1;
				oo++;
				//~ cout<<a[i]<<endl;
			}
		}
	}
	printf("%lld\n",oo);
	return 0;
}

Compilation message

nizin.cpp: In function 'int main()':
nizin.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
nizin.cpp:29:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Runtime error 18 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 85 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 89 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 86 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 86 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 88 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 115 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 145 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 155 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -