# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1000564 | 2024-06-17T19:02:53 Z | De3b0o | Reconstruction Project (JOI22_reconstruction) | C++14 | 2074 ms | 49624 KB |
#include<bits/stdc++.h> #define ll long long #define F first #define S second #define in insert #define pb push_back #define ppb pop_back() #define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define cans cout << ans << "\n"; #define yes cout << "Yes" << "\n"; #define no cout << "No" << "\n"; #define pll pair<ll,ll> #define lin cout << "\n"; #define sqr 340 #define mod 1000000007 #define mid ((l+r)/2) #define lc (2*x) #define rc (2*x+1) using namespace std; ll n , m , q; pll a[1000009]; ll fans[1000009]; vector<ll> ed[509]; ll idx[509]; ll ls[509]; int main() { d3 cin >> n >> m; for(int i = 0 ; m>i ; i++) { ll u , v , w; cin >> u >> v >> w; ed[u].pb(w); } for(int i = 1 ; n>=i ; i++) { ls[i]=1e18; sort(ed[i].begin(),ed[i].end()); ed[i].pb(1e18); } cin >> q; for(int i = 0 ; q>i ; i++) { ll x; cin >> x; a[i].F=x; a[i].S=i; } sort(a,a+q); ll px = -1; for(int i = 0 ; q>i ; i++) { ll x = a[i].F; ll ans = 0; for(int j = 1 ; n>j ; j++) { int h = idx[j]; ls[j]+=x-px; for(; ed[j].size()>h ; h++) { if(abs(ed[j][h]-x)>ls[j]) break; ls[j]=abs(ed[j][h]-x); } h--; idx[j]=h; ans+=ls[j]; } fans[a[i].S]=ans; px=x; } for(int i = 0 ; q>i ; i++) cout << fans[i] << "\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 0 ms | 2396 KB | Output is correct |
4 | Correct | 2023 ms | 47472 KB | Output is correct |
5 | Correct | 2074 ms | 47448 KB | Output is correct |
6 | Correct | 2021 ms | 47472 KB | Output is correct |
7 | Correct | 1726 ms | 49232 KB | Output is correct |
8 | Correct | 1560 ms | 49624 KB | Output is correct |
9 | Correct | 1554 ms | 49304 KB | Output is correct |
10 | Correct | 1754 ms | 47440 KB | Output is correct |
11 | Correct | 1457 ms | 49608 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |