# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
576194 | 2022-06-12T13:25:57 Z | jamezzz | Reconstruction Project (JOI22_reconstruction) | C++17 | 331 ms | 27868 KB |
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define fi first #define se second #define pb push_back #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() typedef long long ll; typedef pair<int,int> ii; #define maxn 505 int n,m; vector<int> v[maxn]; vector<pair<int,ii>> c; int main(){ sf("%d%d",&n,&m); for(int i=0;i<m;++i){ int a,b,w; sf("%d%d%d",&a,&b,&w); v[a].pb(w); } pair<ll,ll> val; for(int i=1;i<n;++i){ sort(all(v[i])); val.fi-=1; val.se+=v[i][0]; for(int j=0;j<sz(v[i]);++j){ c.pb({v[i][j],{2,-2*v[i][j]}}); if(j!=sz(v[i])-1){ int a=v[i][j],b=v[i][j+1]; c.pb({(a+b+1)/2,{-2,b+a}}); } } } sort(all(c)); int q;sf("%d",&q); int cur=0; for(int i=0;i<q;++i){ int x;sf("%d",&x); while(cur!=sz(c)&&c[cur].fi<=x){ val.fi+=c[cur].se.fi; val.se+=c[cur].se.se; ++cur; } pf("%lld\n",val.fi*x+val.se); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 316 KB | Output is correct |
4 | Correct | 311 ms | 25656 KB | Output is correct |
5 | Correct | 289 ms | 25660 KB | Output is correct |
6 | Correct | 303 ms | 25668 KB | Output is correct |
7 | Correct | 308 ms | 27588 KB | Output is correct |
8 | Correct | 291 ms | 27768 KB | Output is correct |
9 | Correct | 331 ms | 27832 KB | Output is correct |
10 | Correct | 296 ms | 25952 KB | Output is correct |
11 | Correct | 296 ms | 27868 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |