#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
int quer1(int a,int b, int A, vector<int> &sub2){
int AA[1];
AA[1] = A;
int BB[b];
for(int i = 0;i<b;i++)BB[i] = sub2[i];
return query(a,b,AA,BB);
}
int quer2(int a,int b, int A, vector<int> &opt){
int AA[1];
AA[1] = A;
int BB[b];
for(int i = 0;i<b;i++)BB[i] = opt[i];
return query(a,b,AA,BB);
}
void subsets(vector<vector<bool>>&matriz, int n){
for (int i = 1; i <= n; ++i){
int sub1 = i;
vector<int>sub2;
for (int j = 1; j <= n; ++j){
if (i == j or matriz[i][j] == true){
continue;
}
else sub2.push_back(j);
}
if (quer1(1, (int)sub2.size(), sub1, sub2)){
vector<int>opt;
int r = (int)sub2.size() - 1, l = 0;
while (l < r){
int m = (l+r)/2;
opt.clear();
for (int x= 0; x <= m; ++x)opt.push_back(sub2[x]);
if (quer2(1, (int)opt.size(), sub1, opt)) r = m;
else l = m+1;
}
setRoad(sub1, opt[l]);
matriz[sub1][opt[l]] = true;
matriz[opt[l]][sub1] = true;
return;
}
}
}
void run (int n){
vector<vector<bool>>matriz(n+1, vector<bool>(n+1, false));
for (int i = 0; i < n-1; ++i){
subsets (matriz, n);
}
}
Compilation message
icc.cpp: In function 'int quer1(int, int, int, std::vector<int>&)':
icc.cpp:6:9: warning: array subscript 1 is above array bounds of 'int [1]' [-Warray-bounds]
6 | AA[1] = A;
| ~~~~^
icc.cpp:5:9: note: while referencing 'AA'
5 | int AA[1];
| ^~
icc.cpp: In function 'int quer2(int, int, int, std::vector<int>&)':
icc.cpp:13:9: warning: array subscript 1 is above array bounds of 'int [1]' [-Warray-bounds]
13 | AA[1] = A;
| ~~~~^
icc.cpp:12:9: note: while referencing 'AA'
12 | int AA[1];
| ^~
icc.cpp: In function 'void subsets(std::vector<std::vector<bool> >&, int)':
icc.cpp:6:9: warning: array subscript 1 is above array bounds of 'int [1]' [-Warray-bounds]
6 | AA[1] = A;
| ~~~~^
icc.cpp:5:9: note: while referencing 'AA'
5 | int AA[1];
| ^~
icc.cpp:13:9: warning: array subscript 1 is above array bounds of 'int [1]' [-Warray-bounds]
13 | AA[1] = A;
| ~~~~^
icc.cpp:12:9: note: while referencing 'AA'
12 | int AA[1];
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
500 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Query cities not in range [1, n] |
2 |
Halted |
0 ms |
0 KB |
- |