社区讨论
提供hack和对拍程序
P5025[SNOI2017] 炸弹参与者 7已保存回复 6
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 6 条
- 当前快照
- 1 份
- 快照标识符
- @m0cbev38
- 此快照首次捕获于
- 2024/08/27 18:59 2 年前
- 此快照最后确认于
- 2025/11/04 22:16 4 个月前
CPP
// 造数据
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <algorithm>
#define int long long
using namespace std;
int rand(int l,int r){
return rand()%(r-l+1)+l;
}
int a[10010];
signed main()
{
srand(time(0));
int t;
scanf("%lld",&t),t*=rand(),t%=100;
while(t-->0)
rand();
int n = 5,x = 100;
for(int i=1;i<=n;i++)
a[i] = rand(-x,x);
sort(a+1,a+n+1);
int tot = 0;
for(int i=1;i<=n;i++)
if( i != n && a[i] == a[i+1] )
a[i] = x+1,tot++;
printf("%lld\n",n-tot);
for(int i=1;i<=n;i++)
if( a[i] != x+1 )
printf("%lld %lld\n",a[i],rand(0,x*2));
return 0;
}
CPP// 对拍
#include <iostream>
#include <stdio.h>
#include <windows.h>
using namespace std;
long long k;
int main()
{
while(true)
{
// ans1.txt文件需要提前创建
system("build.exe < ans1.txt > in.txt");
system("你的程序.exe < in.txt > ans1.txt");
system("标程.exe < in.txt > ans2.txt");
printf("[%lld] ",++k);
if( system("fc ans1.txt ans2.txt") )
break;
}
return 0;
}
CPP// hack
5
-55 7
4 108
53 12
67 17
95 15
回复
共 6 条回复,欢迎继续交流。
正在加载回复...