QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#870548#8619. Interactive Casinoucup-team4893#Compile Error//C++171.3kb2025-01-25 16:46:162025-01-25 16:46:16

Judging History

你现在查看的是最新测评结果

  • [2025-01-25 16:46:16]
  • 评测
  • [2025-01-25 16:46:16]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<fstream>
#include<queue>
#include<time.h>
#include<algorithm>
#define fopen(x, y) freopen(x".in", "r", stdin); freopen(y".out", "w", stdout);
//#define int long long
#ifdef int
#define inf 0x3f3f3f3f3f3f3f3fll
#else
#define inf 0x3f3f3f3f
#endif

using namespace std;

int n, dis[1005], _dis[1005];

vector<int> g[1005][1005];

int ask(int i, int j) {
	if(i == j) return 0;
	cout << i << ' ' << j << '\n';
	fflush(stdout);
	int d; cin >> d;
	if(d == 0) exit(0);
	return d;
}

double x;

mt19937 rng(114514);

bool simu() {
	int m = 1000;
	for(int i = 1; i <= 1000; i++) {
		int l = rng() % m + 1, r = rng() % m + 1;
		if(l > r) swap(l, r);
		if((l + r) / 2.0 <= m / 2.7182) {
			int x = rng() & 1, val = rng() % (r - l + 1) + l;
			if(x) m -= val;
			else m += val * 2;
		}
		if(m < 1) return false;
		if(m >= 10000) return true;
	}
	return false;
}

void test() {
	int cnt = 1000, sum = 0;
	while(cnt--) sum += (simu() == true);
	cout << sum << '\n';
}

signed main() {
//	rng = mt19937(time(0));
//	test();
//	return 0;
	cin >> n; 
	for(int i = 1; i <= n; i++) {
		string s;
		int l, r;
		cin >> s >> l >> r;
		if(((l + r) / 2.0) <= n / 2.7182) {
			cout << "PLAY\n";
			n += (l + r) / 4.0;
		}
		else cout << "SKIP\n";
		fflush(stdout);
	}
}

Details

answer.code:32:1: error: ‘mt19937’ does not name a type
   32 | mt19937 rng(114514);
      | ^~~~~~~
answer.code: In function ‘bool simu()’:
answer.code:37:25: error: ‘rng’ was not declared in this scope
   37 |                 int l = rng() % m + 1, r = rng() % m + 1;
      |                         ^~~
answer.code:38:24: error: ‘r’ was not declared in this scope
   38 |                 if(l > r) swap(l, r);
      |                        ^
answer.code:39:25: error: ‘r’ was not declared in this scope
   39 |                 if((l + r) / 2.0 <= m / 2.7182) {
      |                         ^
answer.code:41:36: error: ‘val’ was not declared in this scope
   41 |                         if(x) m -= val;
      |                                    ^~~
answer.code:42:35: error: ‘val’ was not declared in this scope
   42 |                         else m += val * 2;
      |                                   ^~~