제출 #576194

#제출 시각아이디문제언어결과실행 시간메모리
576194jamezzzReconstruction Project (JOI22_reconstruction)C++17
7 / 100
331 ms27868 KiB
#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); } }

컴파일 시 표준 에러 (stderr) 메시지

reconstruction.cpp: In function 'int main()':
reconstruction.cpp:21:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |  sf("%d%d",&n,&m);
      |    ^
reconstruction.cpp:24:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   sf("%d%d%d",&a,&b,&w);
      |     ^
reconstruction.cpp:44:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |  int q;sf("%d",&q);
      |          ^
reconstruction.cpp:47:11: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |   int x;sf("%d",&x);
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...