Submission #19860

#TimeUsernameProblemLanguageResultExecution timeMemory
19860hjk0553탐사 (KOI13_probe)C++98
4.56 / 19
2081 ms376 KiB
#include<bits/stdc++.h> int k,n,arr[44],sum[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<=k;i++) sum[i]=sum[i-1]+arr[i]; for(i=1;i<=n;i++){ int hap=sum[data[i].e]-sum[data[i].s-1]; if(hap!=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 'void f(int)':
probe.cpp:9:11: warning: unused variable 'j' [-Wunused-variable]
     int i,j,flag=1;
           ^
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...