# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
35144 | 2017-11-18T10:29:29 Z | Pajaraja | Money (IZhO17_money) | C++14 | 0 ms | 9828 KB |
#include <bits/stdc++.h> using namespace std; int bit[1000007],a[1000007],n; void upd(int x) { while(x<=n) { bit[x]++; x+=(x&-x); } } int sum(int x) { int s=0; while(x>0) { s+=bit[x]; x-=(x&-x); } return s; } bool ima(int l,int r) {return sum(r)>sum(l);} int main() { int cnt=1; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&a[i]); upd(a[0]); for(int i=1;i<n;i++) { if(a[i]<a[i-1] || ima(a[i-1],a[i])) cnt++; upd(a[i]); } printf("%d",cnt); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 9828 KB | Output is correct |
2 | Correct | 0 ms | 9828 KB | Output is correct |
3 | Correct | 0 ms | 9828 KB | Output is correct |
4 | Incorrect | 0 ms | 9828 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 9828 KB | Output is correct |
2 | Correct | 0 ms | 9828 KB | Output is correct |
3 | Correct | 0 ms | 9828 KB | Output is correct |
4 | Incorrect | 0 ms | 9828 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 9828 KB | Output is correct |
2 | Correct | 0 ms | 9828 KB | Output is correct |
3 | Correct | 0 ms | 9828 KB | Output is correct |
4 | Incorrect | 0 ms | 9828 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 9828 KB | Output is correct |
2 | Correct | 0 ms | 9828 KB | Output is correct |
3 | Correct | 0 ms | 9828 KB | Output is correct |
4 | Incorrect | 0 ms | 9828 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |