#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
ios_base::sync_with_stdio(0);\
cin.tie(0);\
cout.tie(0)\
// #define int long long
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int par[105], n;
vi s[105];
void Union(int x, int y){
if(s[par[x]].size() > s[par[y]].size()) swap(x, y);
int tmp = par[y];
par[y] = par[x];
for(int i : s[tmp]){
s[par[x]].push_back(i);
}
s[tmp].clear();
}
void run(int N){
n = N;
for(int i = 1; i <= n; i++){
par[i] = i;
s[i].push_back(i);
}
for(int t = 1; t < n; t++){
vi v;
for(int i = 1; i <= n; i++){
if(par[i] == i) v.push_back(i);
}
bool f = false;
for(int i = 0; i < v.size() and !f; i++){
for(int j = 0; j < v.size(); j++){
if(i == j) continue;
int a[] = {i}, b[] = {j};
if(query(1, 1, a, b)){
setRoad(i, j);
Union(i, j);
f = true;
break;
}
}
}
}
}
Compilation message
icc.cpp: In function 'void run(int)':
icc.cpp:53:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for(int i = 0; i < v.size() and !f; i++){
| ~~^~~~~~~~~~
icc.cpp:54:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | for(int j = 0; j < v.size(); j++){
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
344 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |