답안 #688286

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
688286 2023-01-27T09:46:48 Z saayan007 Lost in the cycle (IOI19_cycle) C++17
33 / 100
1 ms 212 KB
#include "cycle.h"

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
using vi = vector<int>;
using vl = vector<long long>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<long long, long long>>;

#define fur(i, a, b) for(ll i = a; i <= (ll)b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= (ll)b; --i)
#define fr first 
#define sc second
#define mp make_pair
#define pb emplace_back
#define nl "\n"
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void escape(int n) {
    ll lo = 0;
    ll hi = n - 1;
    ll cur = 0;
    ll x = 0;
    while(lo != hi) {
        // wanna check if [lo, mid] is doable
        ll mid = (lo + hi) / 2;

        // so need to jump to mid - n/2
        ll y = mid - n/2;
        if(y < 0)
            y += n;

        // the dist I need to jump by to get to y = mid - n/2
        x = y - cur;
        if(x < 0)
            x += n;
        // cout << cur << ' ' << lo << ' ' << mid << ' ' << hi << ' ' << y << ' ' << x << nl;

        if(jump(x)) {
            hi = mid;
        } else {
            lo = mid + 1;
        }
        (cur += x) %= n;
    }

    ll y = lo;
    x = y - cur;
    if(x < 0)
        x += n;
    jump(x);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB The exit was not found.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 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 212 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB The exit was not found.
3 Halted 0 ms 0 KB -