답안 #369234

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
369234 2021-02-21T01:34:39 Z chienyu_xiong Lost in the cycle (IOI19_cycle) C++17
컴파일 오류
0 ms 0 KB
/*
 * CM 	= March
 * M 	= April
 * IM 	= July
 * GM 	= September
 * IGM	= December
*/

#include <bits/stdc++.h>

#define F first
#define S second

#define pb push_back
#define mp make_pair

typedef long long int lli;

#define pll pair<lli, lli>
#define pil pair<int, lli>
#define pli pair<lli, int>
#define pii pair<int, int>
#define pdd pair<double, double>

#define vi vector<int>
#define vl vector<lli>

#define dmx(x, y) x = max(x, y)
#define dmn(x, y) x = min(x, y)

using namespace std;

void setIO(string str, bool dbg) {
	ios_base::sync_with_stdio(0);

	cin.tie(nullptr);
	cout.tie(nullptr);

	if (!dbg) {
		freopen((str + ".in").c_str(), "r", stdin);
		freopen((str + ".out").c_str(), "w", stdout);
	}
}

const int MAX = 1e5 + 5;
const int LEN = 2e1 + 1;
const int LVL = 2e1 + 0;
const lli MOD = 1e9 + 7;
const lli INF = 9e17;

int xyz = 1; // test cases

int amount(int src, int dst, int n) {
	return (dst - src + n) % n;
}

bool move(int dis) {
	return jump(dis);
	//tmp += dis;
	//tmp %= n;
	//return tmp == 0 || tmp > (n / 2);
}

void escape(int n) {
	bool val = move(0);
	
	if (!val) {
		//cout << "debug" << endl;
		if (!move((n + 1) / 2)) {
			move(n - 1); return;
		}
	}
	
	int cur = 0;
	int lo = 0;
	int hi = n / 2;
	while (lo < hi) {
		int mid = (lo + hi + 1) / 2;
		
		int cng = amount(cur, mid, n);
		if (!move(cng)) hi = mid - 1;
		else lo = mid;		
		cur = mid;
		
		//cout << lo << " " << hi << ": " << cur << endl;
	}
	
	move(amount(cur, lo, n));
}

void fnc() {
	//cin >> n; escape(n);
}

int main() {
	setIO("", 1);

	while (xyz--) fnc();

	return 0;
}




















Compilation message

cycle.cpp: In function 'bool move(int)':
cycle.cpp:58:9: error: 'jump' was not declared in this scope
   58 |  return jump(dis);
      |         ^~~~
cycle.cpp: In function 'void setIO(std::string, bool)':
cycle.cpp:40:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   40 |   freopen((str + ".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cycle.cpp:41:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   41 |   freopen((str + ".out").c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~