# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
875537 | 2023-11-20T02:37:59 Z | reginox | Nizin (COCI16_nizin) | C++17 | 50 ms | 10216 KB |
#include <bits/stdc++.h> #define ll long long #define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define sp << " " #define task "" using namespace std; const ll maxn = 1e6+1; ll n, a[maxn], l, r, cnt; int main(){ if(fopen(task".inp","r")){ freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } faster cin >> n; for(ll i = 1; i <= n; i++) cin >> a[i]; l=1, r=n; while(l<=r){ while(l<=r && a[l]<a[r]){ a[l+1]+=a[l]; l++; cnt++; } if(a[l]==a[r]) l++,r--; while(l<=r && a[l]>a[r]){ a[r-1]+=a[r]; r--; cnt++; } if(a[l]==a[r]) l++,r--; } cout << cnt; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 436 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 468 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2648 KB | Output is correct |
2 | Correct | 5 ms | 2652 KB | Output is correct |
3 | Correct | 5 ms | 2652 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 5372 KB | Output is correct |
2 | Correct | 18 ms | 5468 KB | Output is correct |
3 | Correct | 21 ms | 5764 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 8300 KB | Output is correct |
2 | Correct | 40 ms | 8316 KB | Output is correct |
3 | Correct | 50 ms | 9312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 44 ms | 9812 KB | Output is correct |
2 | Correct | 42 ms | 10064 KB | Output is correct |
3 | Correct | 48 ms | 10216 KB | Output is correct |