제출 #429287

#제출 시각아이디문제언어결과실행 시간메모리
429287Dremix10전선 연결 (IOI17_wiring)C++17
13 / 100
39 ms3756 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define endl '\n' #define all(x) (x).begin(),(x).end() #ifdef dremix #define p(x) cerr<<#x<<" = "<<x<<endl; #define p2(x,y) cerr<<#x<<", "<<#y<<" = {"<<x<<", "<<y<<"}"<<endl; #define pp(x) cerr<<#x<<" = "<<"("<<x.F<<" - "<<x.S<<")"<<endl; #define pv(x) cerr<<#x<<" = "<<"{";for(auto y : x)cerr<<y<<", ";cerr<<"}"<<endl; #define ppv(x) cerr<<#x<<" = "<<"{";for(auto y : x)cerr<<y.F<<"-"<<y.S<<", ";cerr<<"}"<<endl; #else #define p(x) #define p2(x,y) #define pp(x) #define pv(x) #define ppv(x) #endif #define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); const int maxp = 22; const ld EPS = 1e-9; const ll INF = 1e18; const int MOD = 1e9+7; const int N = 3e5+1; long long min_total_length(vector<int> a, vector<int> b) { int n = a.size(); int m = b.size(); int i,j; ll ans = 0; if(n>=m){ for(i=0;i<n;i++) ans += b[0]-a[i]; int cnt = m-1; for(i=1;i<m;i++){ ans += 1ll*(b[i]-b[i-1])*cnt; cnt--; } } else{ for(i=0;i<m;i++) ans += b[i]-a[n-1]; int cnt = n-1; for(i=n-2;i>=0;i--){ ans += 1ll*(a[i+1]-a[i])*cnt; cnt--; } } return ans; /* g++ grader.cpp wiringSub2.cpp -Ddremix 5 4 1 3 5 6 7 9 10 15 17 */ }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:37:11: warning: unused variable 'j' [-Wunused-variable]
   37 |     int i,j;
      |           ^
#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...