티스토리 뷰

Study

dm.cpp

arnold518 2021. 1. 26. 16:05
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

mt19937 rng(chrono::high_resolution_clock().now().time_since_epoch().count());
ll rand(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(rng); }

void compile()
{
	system("g++ -std=c++17 -O2 -o PROBLEM grader.cpp PROBLEM.cpp");
	system("g++ -std=c++17 -O2 -o PROBLEM2 grader.cpp PROBLEM2.cpp");
}

void input()
{
	FILE *in=fopen("in", "w");
	fclose(in);
}

vector<char> read(char *S)
{
	FILE *out=fopen(S, "r");
	char c; vector<char> V;
	c=getc(out);
	while(c!=EOF)
	{
		V.push_back(c);
		c=getc(out);
	}
	fclose(out);
	return V;
}

bool run()
{
	system("./PROBLEM <in >out");
	system("./PROBLEM2 <in >out2");
	return read("out")==read("out2");
}

int main()
{
	compile();
	for(int tc=1; ; tc++)
	{
		printf("TC %d\n", tc);
		input();
		if(!run()) break;
	}
}

'Study' 카테고리의 다른 글

수열과 쿼리  (0) 2019.10.29
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함