제출 #560972

#제출 시각아이디문제언어결과실행 시간메모리
560972HuyGap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
#include "gap.h" //#include<bits/stdc++.h> #define int long long #define pii pair<int,int> #define fi first #define se second /*#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma")*/ using namespace std; using ll = long long; using ull = unsigned long long; using ldb = long double; const int N = (int)5e5; const int maxN = (int)5e5 + 5; const int mod = 1e9 + 7; //const int mod = 998244353; const ll infty = 1e18; const ll logn = 18; const int base = 311; const int Block_size = 500; const int ep = 'a'; int cu[] = {0,0,1,-1}; int cv[] = {-1,1,0,0}; int du[] = {-1,-1,+1,1}; int dv[] = {-1,+1,-1,1}; int cled[] = {6,2,5,5,4,5,6,3,7,6}; void InputFile() { freopen(".inp","r",stdin); freopen(".out","w",stdout); //freopen("test.out","r",stdin); } void FastInput() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } /*void MinMax(int L,int R,int x,int y) { return; }*/ ll findGap(int T, int n) { if(T == 1) { ll a[maxN]; ll L = 0; ll R = infty; for(int i = 1;i <= (n + 1)/2;i++) { MinMax(L,R,&a[i],&a[n+1-i]); L = a[i+1]; R = a[n+i-1]-1; } ll res = 0; for(int i = 2;i <= n;i++) { res = max(res,a[i]-a[i-1]); } return res; } ll res = 0; ll mini,maxi; MinMax(0,infty, &mini, &maxi); ll pre = mini; ll h = (maxi - mini + n - 2) / (n - 1); ll now = mini + 1; while(true) { ll p, q; MinMax(now, now + h - 1, &p, &q); res = max(res, p - pre); pre = max(pre, q); now += h; if(q == maxi) break; } return res; } /*void Read() { } void Solve() { } void Debug() { //Main_sub(); //Naive(); } signed main() { FastInput(); //InputFile(); //int sub_type; //cin >> sub_type; //Sieve(); int test; //cin >> test; test = 1; while(test--) //for(int prc = 1; prc <= test; prc++) { Read(); Solve(); //Debug(); } }*/

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

gap.cpp: In function 'void InputFile()':
gap.cpp:36:24: error: 'stdin' was not declared in this scope
   36 |     freopen(".inp","r",stdin);
      |                        ^~~~~
gap.cpp:2:1: note: 'stdin' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
    1 | #include "gap.h"
  +++ |+#include <cstdio>
    2 | //#include<bits/stdc++.h>
gap.cpp:36:5: error: 'freopen' was not declared in this scope
   36 |     freopen(".inp","r",stdin);
      |     ^~~~~~~
gap.cpp:37:24: error: 'stdout' was not declared in this scope
   37 |     freopen(".out","w",stdout);
      |                        ^~~~~~
gap.cpp:37:24: note: 'stdout' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
gap.cpp: In function 'void FastInput()':
gap.cpp:43:5: error: 'ios_base' has not been declared
   43 |     ios_base::sync_with_stdio(false);
      |     ^~~~~~~~
gap.cpp:44:5: error: 'cin' was not declared in this scope
   44 |     cin.tie(nullptr);
      |     ^~~
gap.cpp:2:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include "gap.h"
  +++ |+#include <iostream>
    2 | //#include<bits/stdc++.h>
gap.cpp: In function 'll findGap(long long int, long long int)':
gap.cpp:68:19: error: 'max' was not declared in this scope; did you mean 'maxN'?
   68 |             res = max(res,a[i]-a[i-1]);
      |                   ^~~
      |                   maxN
gap.cpp:82:15: error: 'max' was not declared in this scope; did you mean 'maxi'?
   82 |         res = max(res, p - pre);
      |               ^~~
      |               maxi