Submission #1206913

#TimeUsernameProblemLanguageResultExecution timeMemory
1206913thangdzwinioiReal Mountains (CCO23_day1problem2)C++20
0 / 25
0 ms320 KiB
#include <bits/stdc++.h>
using namespace std;
// Tên chương trình
const string NAME = "chill";
// Số test kiểm tra
const int NTEST = 10000;


// Viết lại hàm random để sử dụng cho thuận tiện. Hàm random này sinh ngẫu nhiên số trong phạm vi long long, số sinh ra >= l và <= h.
long long Rand(long long l, long long h) {
    return 1ll * rand() * rand() % (h - l + 1) + l;
}

int main()
{
    srand(time(NULL));
    for (int iTest = 1; iTest <= NTEST; iTest++)
    {
        ofstream inp((NAME + ".inp").c_str());

        int MAX = 5;

        int n = Rand(1, MAX); inp << n << "\n";
        while (n --){
            inp << Rand(1, MAX) << ' ';
        }

        inp.close();
        // Nếu dùng Linux thì "./" + Tên chương trình
        system((NAME + ".exe").c_str());
        system((NAME + "_trau.exe").c_str());
        // Nếu dùng linux thì thay fc bằng diff
        if (system(("fc " + NAME + ".out " + NAME + ".ans").c_str()) != 0)
        {
            cout << "Test " << iTest << ": WRONG!\n";
            return 0;
        }
        cout << "Test " << iTest << ": CORRECT!\n";
    }
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:30:15: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |         system((NAME + ".exe").c_str());
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:31:15: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |         system((NAME + "_trau.exe").c_str());
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...