# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
46427 | 2018-04-20T15:27:16 Z | RezwanArefin01 | Election Campaign (JOI15_election_campaign) | C++17 | 211 ms | 12464 KB |
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; const int maxn = 1e5 + 10; vector<int> adj[maxn]; vector<ii> q[maxn]; ll dp[maxn]; int n, m; void solve23() { for(int i = 1; i <= n; i++) { for(auto it : q[i]) { dp[i] = max(dp[i], dp[it.first - 1] + it.second); } } printf("%lld\n", dp[n]); exit(0); } int main(int argc, char const *argv[]) { #ifdef LOCAL_TESTING freopen("in", "r", stdin); #endif scanf("%d", &n); bool subtask23 = 1; for(int i = 1; i < n; i++) { int u, v; scanf("%d %d", &u, &v); subtask23 &= (u == i && v == u + 1); adj[u].push_back(v); adj[v].push_back(u); } scanf("%d", &m); for(int i = 0; i < m; i++) { int x, y, c; scanf("%d %d %d", &x, &y, &c); if(x > y) swap(x, y); q[y].emplace_back(x, c); } if(subtask23) solve23(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4984 KB | Output is correct |
2 | Incorrect | 5 ms | 5124 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5124 KB | Output is correct |
2 | Incorrect | 6 ms | 5124 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5124 KB | Output is correct |
2 | Incorrect | 6 ms | 5124 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 211 ms | 12464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4984 KB | Output is correct |
2 | Incorrect | 5 ms | 5124 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4984 KB | Output is correct |
2 | Incorrect | 5 ms | 5124 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |