# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
40704 | 2018-02-06T19:33:45 Z | Hassoony | Baloni (COCI15_baloni) | C++14 | 476 ms | 804 KB |
#include <stdio.h> #include <stdlib.h> #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double D; const ll inf=(1ll<<61); const ll mod=1e9+7; const int MX=1e6+9; int n,a[MX],ans,x; multiset<int>s; int main(){ cin>>n; for(int i=0;i<n;i++){ scanf("%d",&x); if(s.find(x)!=s.end()){ s.erase(s.find(x)); x--; if(x>=1)s.insert(x); continue; } else s.insert(x-1),ans++; } cout<<ans<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 352 KB | Output is correct |
3 | Correct | 3 ms | 556 KB | Output is correct |
4 | Correct | 4 ms | 556 KB | Output is correct |
5 | Correct | 381 ms | 604 KB | Output is correct |
6 | Correct | 476 ms | 660 KB | Output is correct |
7 | Correct | 404 ms | 804 KB | Output is correct |
8 | Correct | 368 ms | 804 KB | Output is correct |
9 | Correct | 366 ms | 804 KB | Output is correct |
10 | Correct | 414 ms | 804 KB | Output is correct |