답안 #587857

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
587857 2022-07-02T12:17:13 Z xynex Gap (APIO16_gap) C++17
17.57 / 100
49 ms 1184 KB
#include <bits/stdc++.h>
 
#include "gap.h"
using namespace std;
 
#define ll long long
#define dl double long
#define ull unsigned long long
#define pr pair
#define vt vector
#define ff first
#define ss second
#define mp make_pair
#define sz(a) (int)a.size()
#define pb push_back
#define pf push_front
#define popB pop_back
#define popF pop_front
#define bit_count __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed << setprecision(x)
 
template<typename T> T get_rand(T l, T r) {
  random_device rd;
  mt19937 gen(rd());
  return uniform_int_distribution<T>(l, r)(gen);
}
template<typename T> T lcm(T a, T b) { return a * (b / __gcd(a, b)); }
 
template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(array<A, S>& a);
template<class T> void read(T& x) { cin >> x; }
void read(double& d) { string t; read(t); d = stod(t); }
void read(long double& d) { string t; read(t); d = stold(t); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }
template<class A> void read(vt<A>& x) { for (auto& a : x) read(a); }
template<class A, size_t S> void read(array<A, S>& x) { for (auto& a : x) read(a); }
 
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return string(s); }
string to_string(string s) { return s; }
string to_string(vt<bool> v) { string res; for (int i = 0; i < sz(v); ++i) res += char('0' + v[i]); return res; }
template<size_t S> string to_string(bitset<S> b) { string res; for (int i = 0; i < S; ++i) res += char('0' + b[i]); return res; }
template<class T> string to_string(T v) { bool f = 1; string res; for (auto x : v) { if (!f) res += ' '; f = 0; res += to_string(x); } return res; }
 
template<class A> void write(A x) { cout << to_string(x); }
template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); }
 
void print() { write("\n"); }
template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); }
 
void freop(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
 
const int MOD = 1e9 + 7;
const int N = 8e6 + 5;
const ll INF = 9e18;
const int M = 3e3 + 5;
const dl pi = acos(-1);
const dl eps = 1e-12;
const int sq = 700;
 
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
/* ll vs int*/
long long findGap(int T,int N) {
  ll f = 0, err = 0;
  MinMax(0ll, INF, &f, &err);
  ll s = 0;
  MinMax(f + 1, INF, &s, &err);
  ll mxGap = s - f;
  ll last = s;
  while(1) {
    ll cur = 0;
    ll next = 0;
    MinMax(last + 1, last + mxGap, &cur, &next);
    if(cur == -1) {
      MinMax(last + 1, INF, &cur, &next);
      if(cur == -1) break;
      mxGap = cur - last;
      last = cur;
    }
    else {
      last = next;
    }
  }
 // print(f, s);
	return mxGap;
}
 
 
/*int main() {
    read(n);
    for(int i = 1; i <= n; ++i) {
      read(A[i]);
    }
    print(findGap(1, n));
    print(call_count);
    return 0;
}*/

Compilation message

gap.cpp: In function 'void freop(std::string)':
gap.cpp:55:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |   freopen((s + ".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gap.cpp:56:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   56 |   freopen((s + ".out").c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Incorrect 0 ms 208 KB Output isn't correct
3 Incorrect 0 ms 208 KB Output isn't correct
4 Incorrect 0 ms 208 KB Output isn't correct
5 Incorrect 0 ms 208 KB Output isn't correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Incorrect 1 ms 208 KB Output isn't correct
16 Correct 8 ms 464 KB Output is correct
17 Correct 9 ms 432 KB Output is correct
18 Correct 7 ms 592 KB Output is correct
19 Correct 6 ms 424 KB Output is correct
20 Correct 6 ms 464 KB Output is correct
21 Correct 25 ms 1056 KB Output is correct
22 Correct 24 ms 1068 KB Output is correct
23 Correct 30 ms 1080 KB Output is correct
24 Correct 25 ms 1068 KB Output is correct
25 Incorrect 49 ms 1064 KB Output isn't correct
26 Correct 26 ms 1064 KB Output is correct
27 Correct 30 ms 1056 KB Output is correct
28 Correct 26 ms 988 KB Output is correct
29 Correct 34 ms 976 KB Output is correct
30 Correct 25 ms 1008 KB Output is correct
31 Incorrect 1 ms 280 KB Output isn't correct
32 Correct 0 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 208 KB Partially correct
2 Partially correct 0 ms 208 KB Partially correct
3 Partially correct 1 ms 208 KB Partially correct
4 Partially correct 0 ms 208 KB Partially correct
5 Partially correct 0 ms 208 KB Partially correct
6 Partially correct 0 ms 208 KB Partially correct
7 Partially correct 1 ms 208 KB Partially correct
8 Partially correct 1 ms 208 KB Partially correct
9 Partially correct 0 ms 208 KB Partially correct
10 Partially correct 1 ms 208 KB Partially correct
11 Partially correct 1 ms 208 KB Partially correct
12 Partially correct 1 ms 208 KB Partially correct
13 Partially correct 1 ms 208 KB Partially correct
14 Partially correct 1 ms 208 KB Partially correct
15 Partially correct 1 ms 208 KB Partially correct
16 Partially correct 8 ms 440 KB Partially correct
17 Partially correct 7 ms 428 KB Partially correct
18 Partially correct 6 ms 464 KB Partially correct
19 Partially correct 6 ms 464 KB Partially correct
20 Partially correct 5 ms 464 KB Partially correct
21 Partially correct 30 ms 1056 KB Partially correct
22 Partially correct 23 ms 1056 KB Partially correct
23 Partially correct 24 ms 1056 KB Partially correct
24 Partially correct 32 ms 1044 KB Partially correct
25 Partially correct 45 ms 1080 KB Partially correct
26 Partially correct 26 ms 980 KB Partially correct
27 Partially correct 31 ms 1072 KB Partially correct
28 Partially correct 33 ms 968 KB Partially correct
29 Partially correct 33 ms 1184 KB Partially correct
30 Partially correct 22 ms 976 KB Partially correct
31 Partially correct 0 ms 208 KB Partially correct
32 Partially correct 0 ms 208 KB Partially correct