//
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
using namespace std;
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int ra(int l,int r){
assert(l <= r);
return l + rd() % (r - l + 1);
}
const int N = 1e6 + 5;
int cnt[10000], l[100000], pa[N];
int f(int u){
return pa[u] == u ? u : pa[u] = f(pa[u]);
}
bool fl[N];
signed main(){
srand(time(NULL));
for(int tt = 1; ; tt ++){
ofstream inp("v.inp");
// int n = ra(200, 300), q = ra(200, 300);
// inp << n << " " << q << "\n";
// for(int i = 1; i <= n; i ++) inp << ra(0, n) << " ";
// inp << "\n";
// while(q--){
// int l = ra(1, n);
// inp << l << " " << ra(l, n) << "\n";
// }
int n = ra(600, 800), m = ra(n - 1, 1000);
inp << n << " " << m << "\n";
for(int i = 1; i <= n; i ++) pa[i] = i;
for(int i = 1; i <= n - 1; i ++){
while(true){
int u = ra(1, n);
int v = ra(1, n);
int x = f(u);
int y = f(v);
if(x == y) continue;
pa[x] = y;
inp << u << " " << v << " " << ra(1, 1e9) << "\n";
break;
}
}
m = m - (n - 1);
for(int i = 1; i <= m; i ++){
while(true){
int u = ra(1, n);
int v = ra(1, n);
if(u == v) continue;
inp <<u << " " << v << " " << ra(1, 1e9) << "\n";
break;
}
}
int q = ra(100, 200);
inp << q << "\n";
while(q--){
while(true){
int u = ra(1, n);
int v = ra(1, n);
if(u == v) continue;
inp <<u << " " << v << "\n";
break;
}
}
inp.close();
int st = clock();
system("v.exe");
int ed = clock();
cerr << 1.0 * (ed - st) / CLOCKS_PER_SEC << "\n";
double kt = 1.0 * (ed - st) / CLOCKS_PER_SEC;
// if(kt > 0.5000){
// cout << "HET CUU\n";
// return 0;
// }
system("v_trau.exe");
if(system("fc v.out v.ans")){
cout << "WA\n";
return 0;
}else{
cout << "AC\n";
// return 0;
}
}
}
Compilation message
swap.cpp: In function 'int main()':
swap.cpp:84:16: warning: unused variable 'kt' [-Wunused-variable]
84 | double kt = 1.0 * (ed - st) / CLOCKS_PER_SEC;
| ^~
swap.cpp:80:15: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
80 | system("v.exe");
| ~~~~~~^~~~~~~~~
swap.cpp:89:15: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
89 | system("v_trau.exe");
| ~~~~~~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccf8uMEU.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccmZ0yaX.o:swap.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccf8uMEU.o: in function `main':
grader.cpp:(.text.startup+0x1c3): undefined reference to `init(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x217): undefined reference to `getMinimumFuelCapacity(int, int)'
collect2: error: ld returned 1 exit status