Submission #259710

#TimeUsernameProblemLanguageResultExecution timeMemory
259710arnold518Worst Reporter 2 (JOI16_worst_reporter2)C++14
15 / 100
10 ms10880 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2e5; int N; pii A[MAXN+10], B[MAXN+10]; int dp[(1<<16)+10][20]; int solve(int mask, int p) { if(p==N+1) return 0; int &ret=dp[mask][p]; if(ret!=-1) return ret; ret=987654321; for(int i=1; i<=N; i++) { if(mask&(1<<(i-1))) continue; if(A[p].first>B[i].first) continue; if(A[p].second!=B[i].second) ret=min(ret, solve(mask|(1<<(i-1)), p+1)+1); else ret=min(ret, solve(mask|(1<<(i-1)), p+1)); } return ret; } int main() { scanf("%d", &N); for(int i=1; i<=N; i++) scanf("%d%d", &A[i].second, &A[i].first); for(int i=1; i<=N; i++) scanf("%d%d", &B[i].second, &B[i].first); memset(dp, -1, sizeof(dp)); printf("%d\n", solve(0, 1)); }

Compilation message (stderr)

worst_reporter2.cpp: In function 'int main()':
worst_reporter2.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
worst_reporter2.cpp:36:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=N; i++) scanf("%d%d", &A[i].second, &A[i].first);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
worst_reporter2.cpp:37:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=N; i++) scanf("%d%d", &B[i].second, &B[i].first);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...