답안 #14288

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14288 2015-05-10T03:01:43 Z tjdals1865 탐사 (KOI13_probe) C++
5.89 / 19
2000 ms 420 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]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 420 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1774 ms 352 KB Output is correct
3 Correct 245 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Execution timed out 2033 ms 228 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2003 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2033 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -