# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
14285 | tjdals1865 | 탐사 (KOI13_probe) | C++98 | 2100 ms | 396 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stdlib.h>
int len,robotcnt,robot[1000][4],i,thing[40],ans=0;
int check(){
int j;
for(j=0;j<robotcnt;j++)
if(robot[j][2]<robot[j][3]) return 2;
for(j=0;j<robotcnt;j++)
if(robot[j][2]!=robot[j][3]) return 1;
return 0;
}
void input(){
scanf("%d %d",&len,&robotcnt);
for(i=0;i<robotcnt;i++)
scanf("%d %d %d",&robot[i][0],&robot[i][1],&robot[i][2]);
}
void output(){
if(ans==1){
for(i=1;i<=len;i++){
if(thing[i]==0)
printf("-");
else printf("*");
}
}
else printf("NONE");
}
void process(int depth, int num){
if(depth==len+1) return;
if(ans==1) return;
thing[depth]=num;
for(i=0;i<robotcnt;i++)
if(robot[i][0]<=depth && depth<=robot[i][1] && num==1) robot[i][3]++;
if(check()==2){
for(i=0;i<robotcnt;i++)
if(robot[i][0]<=depth && depth<=robot[i][1] && num==1) robot[i][3]--;
return;
}
else if(check()==1){
process(depth+1,1);
process(depth+1,0);
for(i=0;i<robotcnt;i++)
if(robot[i][0]<=depth && depth<=robot[i][1] && num==1) robot[i][3]--;
}
else ans=1;
}
int main(void){
input();
process(1,1);
process(1,0);
output();
return 0;
}
Compilation message (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |