# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
166843 | anubhavdhar | Nizin (COCI16_nizin) | C++14 | 81 ms | 10232 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,N) for(i=0;i<N;i++)
#define FORe(i,N) for(i=1;i<=N;i++)
#define FORr(i,a,b) for(i=a;i<b;i++)
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define ii pair<ll,ll>
#define vii vector<ii>
const ll MAXN = 1e5;
const ll LOGN = 17;
const ll ROOTN = 320;
const ll INF = 1e17+21;
const ll MOD = 1e9 + 7;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll N,i,a = 0,b = 0,c,d,l = 0,r = 0,ctr = 1;
cin>>N;
ll A[N];
c = d = N-1;
FOR(i,N)
cin>>A[i];
l = A[0];
r = A[N-1];
while(b < c)
{
//cout<<"entering for at ("<<a<<","<<b<<") and ("<<c<<","<<d<<")\n";
if (l == r)
{
//cout<<"found palindrome at ("<<a<<","<<b<<") and ("<<c<<","<<d<<")\n";
ctr += 2;
if(b == c - 1) ctr--;
b++;
c--;
a = b;
d = c;
l = A[b];
r = A[c];
}
else if (l > r)
{
//cout<<"l>r\n";
c--;
r += A[c];
}
else
{
//cout<<"l<r\n";
b++;
l += A[b];
}
//cout<<"finally l = "<<l<<" and r = "<<r<<endl;
}
cout<<N - ctr;
return 0;
}
컴파일 시 표준 에러 (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... |