Submission #98053

#TimeUsernameProblemLanguageResultExecution timeMemory
98053dndhkWorst Reporter 2 (JOI16_worst_reporter2)C++14
0 / 100
2011 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define INF 2000000000 typedef pair<int, int> pii; const int MAX_N = 50; int N; vector<pii> v1, v2; int ans = INF; int idx[MAX_N+1]; int chk[MAX_N+1]; int sum = 0; void dfs(int x){ if(x==N){ ans = min(ans,sum); return; } for(int i=0; i<N; i++){ if(chk[i]==0 && v1[x].second<=v2[i].second){ chk[i]=1; if(v1[x].first!=v2[i].first){ sum++; } dfs(x+1); chk[i] = 0; if(v1[x].first!=v2[i].first){ sum--; } }else if(v1[x].second>v2[i].second){ return; } } } int main(){ scanf("%d", &N); for(int i=0; i<N; i++){ int a, b; scanf("%d%d", &a, &b); v1.push_back({a, b}); } for(int i=0; i<N; i++){ int a, b; scanf("%d%d", &a, &b); v2.push_back({a, b}); } dfs(0); printf("%d", ans); return 0; }

Compilation message (stderr)

worst_reporter2.cpp: In function 'int main()':
worst_reporter2.cpp:41:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
worst_reporter2.cpp:43:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d%d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~
worst_reporter2.cpp:47:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d%d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...