Submission #769826

#TimeUsernameProblemLanguageResultExecution timeMemory
769826anha3k25cvpSegway (COI19_segway)C++14
0 / 100
2 ms340 KiB
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define dl double #define st first #define nd second #define II pair <int, int> using namespace std; const int N = 5 + 1e5; const int inf = 7 + 1e9; vector <int> vis, ans, cnt; vector <vector <int>> a; int main() { #define TASKNAME "" ios_base :: sync_with_stdio (0); cin.tie (0); if ( fopen( TASKNAME".inp", "r" ) ) { freopen (TASKNAME".inp", "r", stdin); freopen (TASKNAME".out", "w", stdout); } int n; cin >> n; a.assign(n + 1, vector <int> (3, 0)); for (int i = 1; i <= n; i ++) for (int j = 0; j < 3; j ++) cin >> a[i][j]; int m; cin >> m; vis.assign(301, 0); while (m --) { int x; cin >> x; vis[x] = 1; } ans.assign(n + 1, 0); cnt.assign(n + 1, 0); for (int pos = 0; pos < 300; pos ++) { vector <int> c; for (int i = 1; i <= n; i ++) c.push_back(ans[i]); sort(c.begin(), c.end()); c.resize(unique(c.begin(), c.end()) - c.begin()); for (int i = 1; i <= n; i ++) { if (vis[pos]) { int val = lower_bound(c.begin(), c.end(), ans[i]) - c.begin(); if (!cnt[i]) cnt[i] = val % 20; } if (cnt[i]) { ans[i] ++; cnt[i] --; } else ans[i] += a[i][pos / 100]; } } for (int i = 1; i <= n; i ++) cout << ans[i] << '\n'; return 0; }

Compilation message (stderr)

segway.cpp: In function 'int main()':
segway.cpp:22:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         freopen (TASKNAME".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
segway.cpp:23:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen (TASKNAME".out", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...