Submission #1345111

#TimeUsernameProblemLanguageResultExecution timeMemory
1345111thaibaotran555JJOOII 2 (JOI20_ho_t2)C++20
0 / 100
0 ms356 KiB
#include <bits/stdc++.h>

using namespace std;

const string NAME = "test";

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define maxN 2000
#define TEST 100

long long rnd(long long l, long long r)
{
    return abs((long long)rng() % (r-l+1)) + l;
}

void genTest()
{
    ofstream inp((NAME + ".INP").c_str());
    int n = rnd(3, maxN);
    int k = rnd(1, n/3);
    char c[3] = {'J', 'O', 'I'};
    string cur;
    for(int i = 0; i < n; i++)
    {
        int tmp = rnd(0, 2);
        cur += c[tmp];
    }
    inp << n << " " << k << '\n';
    inp << cur;
}

bool genCheck()
{
    ifstream out1((NAME + ".OUT").c_str());
    ifstream out2((NAME + ".ANS").c_str());
    int ans1, ans2;
    out1 >> ans1;
    out2 >> ans2;
    return ans1 == ans2;
}

int main()
{
    for(int i = 1; i <= TEST; i++)
    {
        genTest();
        system(".\\main.exe");
        system(".\\brute.exe");
        if(genCheck())
            cout << "Test " << i << ": AC\n";
        else
        {
            cout << "Test " << i << ": WA\n";
            exit(0);
        }
    }
    return 0;
}

Compilation message (stderr)

ho_t2.cpp: In function 'int main()':
ho_t2.cpp:48:15: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |         system(".\\main.exe");
      |         ~~~~~~^~~~~~~~~~~~~~~
ho_t2.cpp:49:15: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |         system(".\\brute.exe");
      |         ~~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...