跳到正文

生活·游记

C++评测机

fly_bamboo约 2 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 2 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#include<windows.h>
#define int long long
using namespace std;
void COLOR_PRINT(const char* s,int color)
{
	HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(handle,FOREGROUND_INTENSITY|color);
	printf(s);
	SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY|7);
	return;
}
int vis[15];
signed main()
{
    auto d_int = std::chrono::seconds(5);  // 原始 duration 类型为 int64_t
    double d_double = std::chrono::duration<double>(d_int).count();  // 转换为 double 类型
	int ans=0;
	for(int i=1;i<=10;i++)
	{
		system("std.exe");
		system("stop.exe");
		auto start = std::chrono::high_resolution_clock::now();
		system("lcs.exe");
		auto end = std::chrono::high_resolution_clock::now();
		if(system("fc 1.out 1.ans")==false)
		{
			vis[i]=1;
		}
		if((double)duration.count()>1.0)
		{
		    vis[i]=2;
		}
	}
	for(int i=1;i<=10;i++)
	{
		if(vis[i]==1)
		{
			COLOR_PRINT("AC ",2);
		}
		else if(vis[i]==2)
		{
			COLOR_PRINT("TLE ",1);
		}
		else
		{
			COLOR_PRINT("WA ",4);
		}
	}
	return 0;
}
原文