제출 #295978

#제출 시각아이디문제언어결과실행 시간메모리
295978Trickster전선 연결 (IOI17_wiring)C++14
0 / 100
1 ms324 KiB
#include "wiring.h" #include <algorithm> #include <string.h> #include <iostream> #include <stdio.h> #include <vector> #include <queue> #include <cmath> #include <set> #include <map> using namespace std; #define N 100010 #define ff first #define ss second #define ll long long #define pb push_back #define mod 1000000007 #define pii pair <int, int> #define sz(a) int(a.size()) // #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") // #pragma GCC optimization ("unroll-loops") ll bigmod(ll a,ll e) {if(e==0)return 1;ll x=bigmod(a*a%mod,e>>1);return e&1?x*a%mod:x;} ll min_total_length(vector <int> r, vector <int> b) { int n = sz(r); int m = sz(b); ll ans; if(n <= m) { for(int i = 0; i < n-1; i++) { ans += b[i] - r[i]; } for(int i = n; i < m; i++) { ans += b[i] - r[n]; } return ans; } int h = n-1; for(int i = 1; i < m; i++) { ans += b[i] - r[h--]; } for(int i = h; i >= 0; i--) { ans += b[1] - r[i]; } return ans; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:45:7: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   45 |   ans += b[i] - r[h--];
#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...