제출 #1324056

#제출 시각아이디문제언어결과실행 시간메모리
1324056pcheloveksHack (APIO25_hack)C++20
컴파일 에러
0 ms0 KiB
#define _CRT_SECURE_NO_WARNINGS

/*
⣿⡟⡡⠾⠛⠻⢿⣿⣿⣿⡿⠃⣿⡿⣿⠿⠛⠉⠠⠴⢶⡜⣦⡀⡈⢿⣿
⡿⢀⣰⡏⣼⠋⠁⢲⡌⢤⣠⣾⣷⡄⢄⠠⡶⣾⡀⠀⣸⡷⢸⡷⢹⠈⣿
⡇⢘⢿⣇⢻⣤⣠⡼⢃⣤⣾⣿⣿⣿⢌⣷⣅⡘⠻⠿⢛⣡⣿⠀⣾⢠⣿
⣷⠸⣮⣿⣷⣨⣥⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⢁⡼⠃⣼⣿
⡟⠛⠛⠛⣿⠛⠛⢻⡟⠛⠛⢿⡟⠛⠛⡿⢻⡿⠛⡛⢻⣿⠛⡟⠛⠛⢿
⡇⢸⣿⠀⣿⠀⠛⢻⡇⠸⠃⢸⡇⠛⢛⡇⠘⠃⢼⣷⡀⠃⣰⡇⠸⠇⢸
⡇⢸⣿⠀⣿⠀⠛⢻⡇⢰⣿⣿⡇⠛⠛⣇⢸⣧⠈⣟⠃⣠⣿⡇⢰⣾⣿
⣿⣿⣿⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢋⣿⠙⣷⢸⣷⠀⣿⣿⣿
⣿⣿⣿⡇⢻⣿⣿⣿⡿⠿⢿⣿⣿⣿⠟⠋⣡⡈⠻⣇⢹⣿⣿⢠⣿⣿⣿
⣿⣿⣿⣿⠘⣿⣿⣿⣿⣯⣽⣉⣿⣟⣛⠷⠙⢿⣷⣌⠀⢿⡇⣼⣿⣿⣿
⣿⣿⣿⡿⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⡙⢿⢗⣀⣁⠈⢻⣿
*/

//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

//Donald Trump pleese save this code
//Babahnineeleven will win IOI 2040
//Babahnineeleven will win IOI 2041
//Babahnineeleven will win IOI 2042
//Babahnineeleven will win IOI 2043
//Babahnineeleven will win IOI 2044
//Babahnineeleven will win IOI 2045
//Babahnineeleven will win IOI 2046
//Babahnineeleven will win IOI 2047
//Babahnineeleven will win IOI 2048
//Tanya Zadniprovska will win EGOI 2025
//Andrew Holod will NOT win IOI 2025
//Andrew Holod did not qualify to IOI 2025))))))))))
//Andrew Kholod will win ICPC WF 2026
//Andrew Pavlyk is best coder in Khmelnytski
//MoonSlay will NOT get Into IOI

#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <queue>
#include <bitset>
#include <stack>
#include <map>
#include <vector>
#include <set>
#include <algorithm>

#define endl '\n'

using namespace std;

FILE* stream;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef pair < ld, ld > pdd;
const long long DIM = 500007;
const ld eps = 1e-12;
const long long INF = 3e18;
const long long Bsize = 450;
const int mod = 1e9 + 7;
const long long NUMSZ = 500;

/*
ll n, opr;

long long collisions(vector<long long> x) {
	opr += x.size();
	ll res = 0;
	map < ll, ll > cnt;
	for (auto val : x) {
		res += cnt[val % n];
		cnt[val % n]++;
	}

	return res;
}
*/

long long collisions(vector<long long> x);

int hack() {
	int k = 32000;

	vector < ll > tmp;
	for (int i = 1; i <= k; i++) tmp.push_back(i);

	ll col = collisions(tmp);
	if (col != 0) {
		for (int i = 1; i <= k; i++) {
			ll cnt = (ll)i * (ll(k / i) * (ll(k / i) - 1) / 2);
			cnt += (k / i) * (k % i);

			if (cnt == col) return i;
		}
	}

	int L = 2, R = k;
	while (L < R) {
		int mid = (L + R) >> 1;

		vector < ll > x;
		for (int i = 1; i <= k; i++) x.push_back(i);
		for (ll i = L; i <= mid; i++) x.push_back(k * i);

		if (collisions(x) > 0) R = mid;
		else L = mid + 1;
	}

	ll val = k * (ll)L;

	L = 1; R = k;
	while (L < R) {
		int mid = (L + R) >> 1;

		vector < ll > x;
		for (int i = L; i <= mid; i++) x.push_back(i);
		x.push_back(val);

		if (collisions(x) > 0) R = mid;
		else L = mid + 1;
	}

	ll C = (L % k);
	return val - (val % n);
}

/*
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifdef _DEBUG
	freopen_s(&stream, "input.txt", "r", stdin);
	freopen_s(&stream, "output.txt", "w", stdout);
#endif

	n = 750000;
	cout << n << " " << hack() << endl;

	cout << opr << endl;

	return 0;
}
*/

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

hack.cpp: In function 'int hack()':
hack.cpp:129:29: error: 'n' was not declared in this scope
  129 |         return val - (val % n);
      |                             ^