Submission #256672

#TimeUsernameProblemLanguageResultExecution timeMemory
256672BruteforcemanArcade (NOI20_arcade)C++11
65 / 100
1082 ms2800 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 10; struct data { int idx; int x, y; bool operator < (data d) const { return idx < d.idx; } }; int dp[maxn]; int a[maxn], t[maxn]; int main() { int n, m; scanf("%d %d", &n, &m); for(int i = 0; i < m; i++) { scanf("%d", &t[i]); } for(int i = 0; i < m; i++) { scanf("%d", &a[i]); } vector <data> v; for(int i = 0; i < m; i++) { data d; d.idx = a[i]; d.x = a[i] + t[i]; d.y = a[i] - t[i]; v.push_back(d); } sort(v.begin(), v.end()); int ans = 0; for(int i = 0; i < m; i++) { dp[i] = 1; for(int j = 0; j < i; j++) { if(v[j].idx < v[i].idx && v[j].x < v[i].x && v[j].y < v[i].y) { dp[i] = max(dp[i], 1 + dp[j]); } } ans = max(ans, dp[i]); } printf("%d\n", ans); return 0; }

Compilation message (stderr)

Arcade.cpp: In function 'int main()':
Arcade.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &n, &m);
   ~~~~~^~~~~~~~~~~~~~~~~
Arcade.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &t[i]);
     ~~~~~^~~~~~~~~~~~~
Arcade.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &a[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...
#Verdict Execution timeMemoryGrader output
Fetching results...