# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
12913 | baneling100 | 탐사 (KOI13_probe) | C++98 | 2036 ms | 668 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>
int K, N, Probe[41][1001][3], Len[41], Ans[41];
int backTrack(int now) {
int i, OK;
if(now>K)
return 1;
else {
Ans[now]=Ans[now-1]+1;
OK=1;
for(i=1 ; i<=Len[now] && OK ; i++) {
if(now==Probe[now][i][2]) {
if(Ans[now]-Ans[Probe[now][i][0]]!=Probe[now][i][1])
OK=0;
}
else
if(Ans[now]-Ans[Probe[now][i][0]]>Probe[now][i][1])
OK=0;
}
if(OK)
if(backTrack(now+1))
return 1;
Ans[now]=Ans[now-1];
OK=1;
for(i=1 ; i<=Len[now] && OK ; i++) {
if(now==Probe[now][i][2]) {
if(Ans[now]-Ans[Probe[now][i][0]]!=Probe[now][i][1])
OK=0;
}
else
if(Ans[now]-Ans[Probe[now][i][0]]>Probe[now][i][1])
OK=0;
}
if(OK)
if(backTrack(now+1))
return 1;
}
return 0;
}
int main(void) {
int i, j, in1, in2, in3;
scanf("%d %d",&K,&N);
for(i=1 ; i<=N ; i++) {
scanf("%d %d %d",&in1,&in2,&in3);
for(j=in1 ; j<=in2 ; j++) {
Len[j]++;
Probe[j][Len[j]][0]=in1-1;
Probe[j][Len[j]][1]=in3;
Probe[j][Len[j]][2]=in2;
}
}
if(backTrack(1))
for(i=1 ; i<=K ; i++) {
if(Ans[i]-Ans[i-1])
printf("#");
else
printf("-");
}
else
printf("NONE");
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... |