Submission #19835

# Submission time Handle Problem Language Result Execution time Memory
19835 2016-02-25T06:08:02 Z hjk0553 탐사 (KOI13_probe) C++
2.47 / 19
2000 ms 424 KB
#include<bits/stdc++.h>
int k,n,arr[44];
struct d{
    int s;
    int e;
    int cnt;
} data[1111];
void f(int pos){
    int i,j,flag=1;
    if(pos>k){
        for(i=1;i<=n;i++){
            int sum=0;
            for(j=data[i].s;j<=data[i].e;j++) sum+=arr[j];
            if(sum!=data[i].cnt) flag=0;
        }
        if(flag){
            for(i=1;i<=k;i++) printf("%c",arr[i]?'#':'-');
            exit(0);
        }
    }
    else{
        for(i=0;i<=1;i++){
            if(arr[pos]==-1){
                arr[pos]=i;
                f(pos+1);
                arr[pos]=-1;
            }
        }
    }
}
int main(){
    memset(arr,-1,sizeof(arr));
    int i;
    scanf("%d %d",&k,&n);
    for(i=1;i<=n;i++) scanf("%d %d %d",&data[i].s,&data[i].e,&data[i].cnt);
    f(1);
    printf("NONE");
    return 0;
}

Compilation message

probe.cpp: In function 'int main()':
probe.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&k,&n);
     ~~~~~^~~~~~~~~~~~~~~
probe.cpp:35:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1;i<=n;i++) scanf("%d %d %d",&data[i].s,&data[i].e,&data[i].cnt);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 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 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 424 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Execution timed out 2088 ms 256 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2045 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2092 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2060 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -