# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94148 | AKaan37 | Nizin (COCI16_nizin) | C++14 | 111 ms | 16128 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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(int i=1;i<=n;i++)
#define mid (start+end)/2
const lo mod = 1000000007;
const lo li = 10000005;
const lo inf = 1000000000;
const lo MAX = 1000000000000000000;
const lo MIN = -1000000000000000000;
const lo LOG = 30;
int n,m,cev,a[li],oo,ama,kk;
vector<int> v;
int main(){
scanf("%d",&n);
FOR{
scanf("%d",&a[i]);
v.pb(a[i]);
}
FOR{
if(i>n/2 && n%2==1) break;
if(i>=n/2 && n%2==0) break;
while(v[i-1]!=v[v.size()-i]){
if(v[i-1]>v[v.size()-i]){
kk+=1;
v[v.size()-i]=v[v.size()-i]+v[v.size()-i-kk];
//~ v.erase(v.begin()+n-i-ama);
oo++;
}
if(v[i-1]<v[v.size()-i]){
ama+=1;
v[i-1]=v[i-1]+v[i-1+ama];
//~ v.erase(v.begin()+i-1+ama);
oo++;
}
//~ cout<<"hello"<<v[0]<<" "<<v[2]<<endl;
}
}
//~ cout<<"**\n";
printf("%d\n",oo);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |