Submission #19835

#TimeUsernameProblemLanguageResultExecution timeMemory
19835hjk0553탐사 (KOI13_probe)C++98
2.47 / 19
2092 ms424 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...