Submission #1186

#TimeUsernameProblemLanguageResultExecution timeMemory
1186gs13068탐사 (KOI13_probe)C++98
14.63 / 19
2057 ms376 KiB
#include<cstdio> #include<cstdlib> bool ans[41]; int max[41]; int min[41]; int a[1000]; int b[1000]; int c[1000]; int n,m; inline bool check() { int i; for(i=0;i<m;i++) { if(max[b[i]]-max[a[i]-1]<c[i])return false; if(min[b[i]]-min[a[i]-1]>c[i])return false; } return true; } inline void backtracking(int x) { int i; if(x>n) { for(i=1;i<=n;i++)printf(ans[i]?"#":"-"); exit(0); } ans[x]=false; for(i=x;i<=n;i++)max[i]--; if(check())backtracking(x+1); ans[x]=true; for(i=x;i<=n;i++){min[i]++;max[i]++;} if(check())backtracking(x+1); for(i=x;i<=n;i++)min[i]--; } int main() { int i; scanf("%d%d",&n,&m); for(i=1;i<=n;i++)max[i]=i; for(i=0;i<m;i++)scanf("%d%d%d",&a[i],&b[i],&c[i]); backtracking(1); puts("NONE"); }

Compilation message (stderr)

probe.cpp: In function 'int main()':
probe.cpp:43:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
probe.cpp:45:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<m;i++)scanf("%d%d%d",&a[i],&b[i],&c[i]);
                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...