Submission #125391

#TimeUsernameProblemLanguageResultExecution timeMemory
125391khsoo01Arranging Tickets (JOI17_arranging_tickets)C++11
10 / 100
244 ms476 KiB
#include<bits/stdc++.h> using namespace std; const int N = 25, inf = 1e9; int n, m, a[N], b[N], s[N], ans = inf; int main() { scanf("%d%d",&n,&m); for(int i=0;i<m;i++) { scanf("%d%d%*d",&a[i],&b[i]); if(a[i] > b[i]) swap(a[i], b[i]); } for(int k=0;k<(1<<m);k++) { fill(s+1, s+1+n, 0); for(int i=0;i<m;i++) { if((1<<i) & k) { s[a[i]]++; s[b[i]]--; } else { s[1]++; s[a[i]]--; s[b[i]]++; } } int C = 0; for(int i=1;i<=n;i++) { s[i] += s[i-1]; C = max(C, s[i]); } ans = min(ans, C); } printf("%d\n", ans); }

Compilation message (stderr)

arranging_tickets.cpp: In function 'int main()':
arranging_tickets.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
arranging_tickets.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%*d",&a[i],&b[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...