# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1000564 | De3b0o | Reconstruction Project (JOI22_reconstruction) | C++14 | 2074 ms | 49624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |