# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
383291 | 2021-03-29T13:07:44 Z | victoriad | Baloni (COCI15_baloni) | C++14 | 539 ms | 6636 KB |
#include <fstream> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <utility> #include <queue> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; vector<bool>p(n,false); vector<int>b; int x=0; vector<int>a(n); for(int i=0;i<n;i++){ cin>>a[i]; } int y; b.push_back(a[0]-1); for(int i=1;i<n;i++){ if(p[i])continue; for(int j=0;j<b.size();j++){ if(a[i]==b[j]){ b[j]--; p[i]=true; break; } } if(!p[i]) b.push_back(a[i]-1); } cout<<b.size(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 2 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 3 ms | 364 KB | Output is correct |
5 | Correct | 294 ms | 6252 KB | Output is correct |
6 | Correct | 539 ms | 6636 KB | Output is correct |
7 | Correct | 442 ms | 5996 KB | Output is correct |
8 | Correct | 416 ms | 6072 KB | Output is correct |
9 | Correct | 377 ms | 6124 KB | Output is correct |
10 | Correct | 448 ms | 6252 KB | Output is correct |