社区讨论

留给后人的数据生成器和对拍器

P4119[Ynoi2018] 未来日记参与者 9已保存回复 10

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
10 条
当前快照
1 份
快照标识符
@lo8uenxg
此快照首次捕获于
2023/10/28 00:43
2 年前
此快照最后确认于
2023/10/28 00:43
2 年前
查看原帖
数据生成器:
CPP
//created time: 2022-05-23 12:40:55
#include <bits/stdc++.h>
using namespace std;
#define _rep(i_,a_,b_) for(int i_ = a_; i_ <= b_; ++i_)
#define mid ((L+R) >> 1)
#define get(x) (((x) - 1) / kb + 1)
typedef long long ll;

namespace FastIO { //by fjy666
	char OBuf[1 << 23], *p = OBuf;
	inline void pc(char c) { *p++=c; }
	inline void out(ll x) { if(x < 0) pc('-'), x = -x; if(x > 9) out(x / 10); pc(x % 10 + '0'); }
	inline void out(int x) { if(x < 0) pc('-'), x = -x; if(x > 9) out(x / 10); pc(x % 10 + '0'); }
	inline void out(char *s) { if(*s) pc(*s),out(s+1); }
	inline void flush(void) { fwrite(OBuf,p - OBuf,1,stdout); }
	struct _Flusher{ ~_Flusher(){ flush(); } } flusher;
	
	char IBuf[1 << 23], *i1 = IBuf,*i2 = IBuf;
	inline char gc(void) { return (i1 == i2 && (i2 = (i1 = IBuf) + fread(IBuf,1,1 << 23,stdin),i1 == i2)) ? EOF : *i1++; }
	inline int in(void) {
		char c = gc(); int x = 0,f = 1; while(!isdigit(c)) { if(c == '-') f = -1; c = gc(); }
		while(isdigit(c)) { x = x * 10 + c - '0', c = gc(); } return x * f;
	}
	inline ll inl(void) {
		char c = gc(); ll x = 0,f = 1; while(!isdigit(c)) { if(c == '-') f = -1; c = gc(); }
		while(isdigit(c)) { x = x * 10 + c - '0', c = gc(); } return x * f;
	}
} using FastIO::pc; using FastIO::out; using FastIO::gc; using FastIO::in; using FastIO::inl;

mt19937 engine((unsigned) time(0));
int gen(int x) { return abs((int) engine()) % x + 1; }
int a[11000000];
const int N = 10000;
int main() {
	int n = gen(N),m = gen(N);
	out(n),pc(' '),out(m),pc('\n');
	_rep(i,1,n) a[i] = gen(N),out(a[i]),pc(' ');
	pc('\n');
	_rep(i,1,m) {
		int op = gen(2),l = gen(n),r = gen(n); 
		if(l > r) swap(l,r);
		out(op),pc(' '),out(l),pc(' '),out(r); 
		if(op == 1) pc(' '), out(gen(N)), pc(' '), out(gen(N)), pc('\n');
		else pc(' '), out(gen(r - l + 1)), pc('\n');
	}
	return 0;
}
其中 N 为数据的范围,N 越小数据越弱
对拍器:
CPP
//created time: 2022-05-23 12:44:09
#include <bits/stdc++.h>
using namespace std;
#define _rep(i_,a_,b_) for(int i_ = a_; i_ <= b_; ++i_)
#define mid ((L+R) >> 1)
#define get(x) (((x) - 1) / kb + 1)
typedef long long ll;

namespace FastIO { //by fjy666
	char OBuf[1 << 23], *p = OBuf;
	inline void pc(char c) { *p++=c; }
	inline void out(ll x) { if(x < 0) pc('-'), x = -x; if(x > 9) out(x / 10); pc(x % 10 + '0'); }
	inline void out(int x) { if(x < 0) pc('-'), x = -x; if(x > 9) out(x / 10); pc(x % 10 + '0'); }
	inline void out(char *s) { if(*s) pc(*s),out(s+1); }
	inline void flush(void) { fwrite(OBuf,p - OBuf,1,stdout); }
	struct _Flusher{ ~_Flusher(){ flush(); } } flusher;
	
	char IBuf[1 << 23], *i1 = IBuf,*i2 = IBuf;
	inline char gc(void) { return (i1 == i2 && (i2 = (i1 = IBuf) + fread(IBuf,1,1 << 23,stdin),i1 == i2)) ? EOF : *i1++; }
	inline int in(void) {
		char c = gc(); int x = 0,f = 1; while(!isdigit(c)) { if(c == '-') f = -1; c = gc(); }
		while(isdigit(c)) { x = x * 10 + c - '0', c = gc(); } return x * f;
	}
	inline ll inl(void) {
		char c = gc(); ll x = 0,f = 1; while(!isdigit(c)) { if(c == '-') f = -1; c = gc(); }
		while(isdigit(c)) { x = x * 10 + c - '0', c = gc(); } return x * f;
	}
} using FastIO::pc; using FastIO::out; using FastIO::gc; using FastIO::in; using FastIO::inl;

int main() {
	int cas = 0;
	while(true) {
		printf("Case %d: \n",++cas);
		system("gen > data.txt");
		system("sol < data.txt > ans.txt");
		double st = clock();
		system("「望月兴叹的第一分块」.exe < data.txt > wa.txt");
		double ed = clock();
		if((ed - st) / CLOCKS_PER_SEC > 0.99114514) {
			puts("Time Limit Exceeded");
			break;
		} else if(system("fc ans.txt wa.txt > nul")) {
			puts("Wrong Answer");
			break ;
		} else puts("Accepted");
	}
	return 0;
}
sol是题解

回复

10 条回复,欢迎继续交流。

正在加载回复...