Submission #14285

# Submission time Handle Problem Language Result Execution time Memory
14285 2015-05-10T02:20:16 Z tjdals1865 탐사 (KOI13_probe) C++
0 / 19
2000 ms 396 KB
#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

probe.cpp: In function 'void input()':
probe.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&len,&robotcnt);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
probe.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d",&robot[i][0],&robot[i][1],&robot[i][2]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Incorrect 2 ms 396 KB Line "**---*--****" doesn't correspond to pattern "[\#\-A-Z]{1,1000}"
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Line "***-**-****-*--*" doesn't correspond to pattern "[\#\-A-Z]{1,1000}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Line "-************************" doesn't correspond to pattern "[\#\-A-Z]{1,1000}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 296 KB Line "---**-*-*------***-**-----" doesn't correspond to pattern "[\#\-A-Z]{1,1000}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2100 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -