제출 #323179

#제출 시각아이디문제언어결과실행 시간메모리
323179couplefireGap (APIO16_gap)C++17
0 / 100
35 ms1236 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; long long solve1(int n){ queue<long long> left; stack<long long> right; int cl = 0, cr = 1000000000000000000; while(left.size()+right.size() < n){ long long a, b; MinMax(cl, cr, &a, &b); left.push(a); right.push(b); cr = b-1, cl = a+1; } vector<long long> v; while(!left.empty()){ v.push_back(left.front()); left.pop(); } while(!right.empty()){ v.push_back(right.top()); right.pop(); } long long ans = 0; for(int i = 1; i<v.size(); i++) ans = max(ans, v[i]-v[i-1]); return ans; } void solve2(int n){ } long long findGap(int T, int N){ if(T == 2) return solve1(N); return 0; }

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

gap.cpp: In function 'long long int solve1(int)':
gap.cpp:7:19: warning: overflow in conversion from 'long int' to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow]
    7 |  int cl = 0, cr = 1000000000000000000;
      |                   ^~~~~~~~~~~~~~~~~~~
gap.cpp:8:33: warning: comparison of integer expressions of different signedness: 'std::queue<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |  while(left.size()+right.size() < n){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
gap.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i = 1; i<v.size(); i++) ans = max(ans, v[i]-v[i-1]);
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...