제출 #1073632

#제출 시각아이디문제언어결과실행 시간메모리
1073632clementineGap (APIO16_gap)C++17
30 / 100
34 ms3968 KiB
#include "gap.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; long long findGap(int T, int N) { ll l = 0; ll r = 10e18; vector<ll> left, right; int calls = (N + 1) / 2; ll mn, mx; for(int j = 1; j <= calls; j ++) { MinMax(l, r, &mn, &mx); if(mn != mx) { right.push_back(mx); } left.push_back(mn); l = mn + 1; r = mx - 1; } ll mxdif = 0; for(int i = 0; i <((int)left.size() - 1); i ++) { mxdif = max(mxdif, left[i + 1] - left[i]); } for(int i = right.size() - 1; i >=1; i --) { mxdif = max(mxdif, right[i-1] - right[i]); } /* for(auto val:left) { cout<< val <<" " ; } cout << '\n'; for(auto val:right) { cout<< val <<" " ; }*/ int s= left.size(); int u = right.size(); mxdif=max(mxdif, right[u-1] - left[s-1]); return mxdif; }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:9:9: warning: overflow in conversion from 'double' to 'll' {aka 'long long int'} changes value from '1.0e+19' to '9223372036854775807' [-Woverflow]
    9 |  ll r = 10e18;
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...