# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1091911 | idk__ | Bouquet (EGOI24_bouquet) | C++14 | 19 ms | 2784 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
pair<int, int>a[n];
bool flag = 1;
bool flag2 = 1;
int xx,yy;
for(int i = 0;i < n; i++){
int x, y; cin >> x >> y;
a[i] = {x, y};
if(!i)xx=y, yy=y;
if(x!=y or xx!=x)flag = 0;
if(y!=0)flag2 = 0;
}
if(flag){
int cnt = 0;
for(int i = 0;i < n;){
i+=xx+1;
cnt++;
}
cout << cnt << endl;
}
// 7
// 0 0 = 1
// 0 0 = 1
// 1 0
// 1 0
// 2 0
// 3 0
// 2 0
//last = 1, 2-1=1
else if(flag2){
int cnt = 0;
int check[n]={};
int last = 0;
for(int i = 0;i < n; i++){
auto [x, y] = a[i];
if(i-x-1 < 0)check[i]=1, cnt++;
else{
if(last < i-x)check[i]=1, cnt++;
}
if(check[i])last = i;
}
cout << cnt << endl;
}
}
컴파일 시 표준 에러 (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... |