Submission #238434

#TimeUsernameProblemLanguageResultExecution timeMemory
238434KastandaSegway (COI19_segway)C++11
100 / 100
304 ms1276 KiB
// Criminal #include<bits/stdc++.h> using namespace std; const int N = 20004; int n, m, A[N][3], dp[N], M[N], C[N], S[N], P[N], T[N]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i ++) for (int w = 0; w < 3; w ++) scanf("%d", &A[i][w]); scanf("%d", &m); for (int i = 1, a; i <= m; i ++) scanf("%d", &a), M[a] = 1; for (int j = 1; j <= 300; j ++) { for (int i = 1; i <= n; i ++) { if (!C[i]) S[i] = A[i][(j - 1) / 100]; else C[i] --; dp[i] += S[i]; } if (!M[j]) continue; iota(P + 1, P + n + 1, 1); sort(P + 1, P + n + 1, [&](int i, int j){return (dp[i] < dp[j]);}); int l = 1; for (int i = 1; i <= n; i ++) { while (l < i && dp[P[l]] < dp[P[i]]) l ++; T[P[i]] = l - 1; } for (int i = 1; i <= n; i ++) if (!C[i]) S[i] = 1, C[i] = T[i] % 20; } for (int i = 1; i <= n; i ++) printf("%d\n", dp[i]); return 0; }

Compilation message (stderr)

segway.cpp: In function 'int main()':
segway.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
segway.cpp:11:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &A[i][w]);
             ~~~~~^~~~~~~~~~~~~~~~
segway.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &m);
     ~~~~~^~~~~~~~~~
segway.cpp:14:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a), M[a] = 1;
         ~~~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...