0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

1. 函数交互测试

https://hydro.ac/d/system_test/record/61a1845753a50c11fd2bd623
This commit is contained in:
Baoshuo Ren 2021-11-27 09:11:45 +08:00 committed by Baoshuo Ren
parent 02b392f386
commit ba7fe27e51
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
15 changed files with 186 additions and 0 deletions

22
Hydro/system_test/1/1.cpp Normal file
View File

@ -0,0 +1,22 @@
#include "coin.h"
using std::cin;
using std::cout;
using std::endl;
int n, c[105], ans;
int main() {
n = getn();
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= 1000; j++) {
c[i] += !!query(i);
}
}
ans = 1;
for (int i = 2; i <= n; i++) {
if (c[i] <= c[ans]) ans = i;
}
submit(ans);
return 0;
}

View File

@ -0,0 +1,44 @@
#include <bits/stdc++.h>
using namespace std;
namespace erwqergdczxv {
static int n, m, cnt;
static bool hasUsedGetN = false;
static bool hasSubmitted = false;
void RE() {
puts("re");
exit(0);
}
int getn() {
if (hasUsedGetN) RE();
cin >> n;
hasUsedGetN = 1;
m = rand() % n + 1;
return n;
}
int query(int x) {
if (!hasUsedGetN || hasSubmitted) RE();
cnt++;
if (cnt > 100000) RE();
if (x == m)
return (rand() % 10 <= 3);
else
return (rand() % 10 <= 4);
}
void submit(int x) {
if (hasSubmitted) RE();
if (x == m)
puts("ok");
else
puts("wa");
hasSubmitted = 1;
}
} // namespace erwqergdczxv
using erwqergdczxv::getn;
using erwqergdczxv::query;
using erwqergdczxv::submit;

View File

@ -0,0 +1,45 @@
#include <bits/stdc++.h>
using namespace std;
namespace ahfiuasykjbvzkw {
static int n, m, cnt;
static bool hasUsedGetN = false;
static bool hasSubmitted = false;
void RE() {
puts("re");
exit(0);
}
int getn() {
if (hasUsedGetN) RE();
cin >> n;
hasUsedGetN = 1;
m = rand() % n + 1;
return n;
}
int query(int x) {
if (!hasUsedGetN || hasSubmitted) RE();
cnt++;
if (cnt > 100000) RE();
if (x == m)
return (rand() % 10 <= 3);
else
return (rand() % 10 <= 4);
}
void submit(int x) {
if (hasSubmitted) RE();
if (x == m)
puts("ok532124524657743124323");
else
puts("wa");
hasSubmitted = 1;
}
} // namespace ahfiuasykjbvzkw
using ahfiuasykjbvzkw::getn;
using ahfiuasykjbvzkw::query;
using ahfiuasykjbvzkw::submit;

View File

@ -0,0 +1,24 @@
type: default
filename: null
checker_type: testlib
checker: spj.cc
user_extra_files:
- coin.h
time: 100ms
memory: 256m
cases:
- input: data1.in
- input: data2.in
- input: data3.in
- input: data4.in
- input: data5.in
- input: data6.in
- input: data7.in
- input: data8.in
- input: data9.in
- input: data10.in

BIN
Hydro/system_test/1/data/data1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Hydro/system_test/1/data/data9.in (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,21 @@
/**
* @file spj.cc
* @author Macesuted Kysic
* @date 2021-02-04
*
* @copyright Copyright (c) 2021
*
*/
#include <string>
#include "testlib.h"
int main(int argc, char* argv[]) {
registerTestlibCmd(argc, argv);
std::string s = ouf.readToken();
if (s == "ok532124524657743124323")
quitf(_ok, "Correct");
else
quitf(_wa, "Wrong Answer");
}