| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 171376 | itiam | Wand (COCI19_wand) | C++11 | 287 ms | 2816 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
using namespace std;
int L[100004],Lp[100004],Lg[100004];
int main(){
int N,M,x,y,poc=0,cnt=0;
cin >> N >> M;
//unos dvoboja
for (int i=0;i<M;i++){
cin >> x >> y;
if (y==1){
L[x]=1;
cnt+=1;
if (cnt==1) poc=x;
else if (x<poc) poc=x;
}
else{
Lp[i-cnt]=x;
Lg[i-cnt]=y;
}
}
//traženje
for (int i=poc;i<=N;i++){
if (cnt==0) break;
if (L[i]==0){
continue;}
for (int j=0;j<M;j++){
if (Lg[j]==i && L[Lp[j]]!=1){
L[Lp[j]]=1;
cnt+=1;
if (Lp[j]<i) i=Lp[j]-1;
}
}
cnt-=1;
}
//ispis
for (int i=1;i<=N;i++){
cout << L[i];
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
