# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1061151 | 2024-08-16T06:41:10 Z | 12345678 | Reconstruction Project (JOI22_reconstruction) | C++17 | 1 ms | 2396 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #pragma gcc-optimize("o3, unroll-loops") const int nx=5e2+5, mx=1e5+5; ll n, m, a[mx], b[mx], w[mx], x, q, idx[nx]; vector<ll> dp[nx]; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>m; for (int i=1; i<=m; i++) cin>>a[i]>>b[i]>>w[i], dp[a[i]].push_back(w[i]); for (int i=1; i<n; i++) sort(dp[i].begin(), dp[i].end()); for (int i=1; i<n; i++) dp[i].push_back(1e18); cin>>q; while (q--) { cin>>x; ll res=0; for (int i=1; i<n; i++) while (idx[i]!=dp[i].size()-1&&x>=dp[i][idx[i]+1]) idx[i]++; for (int i=1; i<n; i++) { ll tmp=min(dp[i][idx[i]+1]-x, dp[i][idx[i]]-x); res+=tmp; } cout<<res<<'\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |