#include <bits/stdc++.h>
#include "grader.h"
//#include "grader.cpp"
#define f first
#define s second
#define pb push_back
#define vec vector
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
typedef pair<int,int> pii;
typedef long double ld;
auto rng=bind(uniform_int_distribution<int>(1,1e9),mt19937(time(0)));
typedef long long ll;
const ll inf=1e18+100;
//const int N=49;
int query(vector<int> q);
void solve(int n){
/// let's try
vec<int>pr(n);iota(all(pr),1);
int cnt=(n>50?4399:n>7?1199:100);cnt--;
vec<vec<ll>>answ(n,vec<ll>(n+1,0));
vec<vec<int>>cntt(n,vec<int>(n+1,0));
// vec<int>p(n)
while(cnt--){
random_shuffle(all(pr));
int how=query(pr);
if(how==n) return;
for(int i=0;i<n;i++){
answ[i][pr[i]]+=how;
cntt[i][pr[i]]++;
}
}
vec<pair<ld,pii>>vc;
for(int i=0;i<n;i++){
for(int j=1;j<=n;j++){
if(cntt[i][j]){
vc.pb({(ld)answ[i][j]/cntt[i][j],{i,j}});
}
else{
j=j;
///feels bad
}
}
}
fill(all(pr),0);
sort(rall(vc));
vec<bool>used(n+1,0);
vec<bool>used1(n+1,0);
for(auto &z : vc){
if(used[z.s.s]) continue;
if(used1[z.s.f]) continue;
// cerr<<
pr[z.s.f]=z.s.s;
used[z.s.s]=1;
used1[z.s.f]=1;
}
// for(auto &z : pr) cout<<z<<' ';
query(pr);
return ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Correct! Number of queries: 100 |
2 |
Correct |
0 ms |
200 KB |
Correct! Number of queries: 5 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 100 |
4 |
Correct |
1 ms |
300 KB |
Correct! Number of queries: 100 |
5 |
Correct |
1 ms |
300 KB |
Correct! Number of queries: 100 |
6 |
Correct |
2 ms |
200 KB |
Correct! Number of queries: 100 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Correct! Number of queries: 100 |
2 |
Correct |
0 ms |
200 KB |
Correct! Number of queries: 5 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 100 |
4 |
Correct |
1 ms |
300 KB |
Correct! Number of queries: 100 |
5 |
Correct |
1 ms |
300 KB |
Correct! Number of queries: 100 |
6 |
Correct |
2 ms |
200 KB |
Correct! Number of queries: 100 |
7 |
Correct |
21 ms |
440 KB |
Correct! Number of queries: 1200 |
8 |
Correct |
23 ms |
440 KB |
Correct! Number of queries: 1200 |
9 |
Correct |
21 ms |
448 KB |
Correct! Number of queries: 1200 |
10 |
Correct |
26 ms |
444 KB |
Correct! Number of queries: 1200 |
11 |
Correct |
22 ms |
304 KB |
Correct! Number of queries: 1200 |
12 |
Correct |
23 ms |
448 KB |
Correct! Number of queries: 1200 |
13 |
Correct |
18 ms |
444 KB |
Correct! Number of queries: 1200 |
14 |
Correct |
20 ms |
436 KB |
Correct! Number of queries: 1200 |
15 |
Correct |
24 ms |
436 KB |
Correct! Number of queries: 1200 |
16 |
Correct |
18 ms |
444 KB |
Correct! Number of queries: 1200 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Correct! Number of queries: 100 |
2 |
Correct |
0 ms |
200 KB |
Correct! Number of queries: 5 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 100 |
4 |
Correct |
1 ms |
300 KB |
Correct! Number of queries: 100 |
5 |
Correct |
1 ms |
300 KB |
Correct! Number of queries: 100 |
6 |
Correct |
2 ms |
200 KB |
Correct! Number of queries: 100 |
7 |
Correct |
21 ms |
440 KB |
Correct! Number of queries: 1200 |
8 |
Correct |
23 ms |
440 KB |
Correct! Number of queries: 1200 |
9 |
Correct |
21 ms |
448 KB |
Correct! Number of queries: 1200 |
10 |
Correct |
26 ms |
444 KB |
Correct! Number of queries: 1200 |
11 |
Correct |
22 ms |
304 KB |
Correct! Number of queries: 1200 |
12 |
Correct |
23 ms |
448 KB |
Correct! Number of queries: 1200 |
13 |
Correct |
18 ms |
444 KB |
Correct! Number of queries: 1200 |
14 |
Correct |
20 ms |
436 KB |
Correct! Number of queries: 1200 |
15 |
Correct |
24 ms |
436 KB |
Correct! Number of queries: 1200 |
16 |
Correct |
18 ms |
444 KB |
Correct! Number of queries: 1200 |
17 |
Incorrect |
206 ms |
3228 KB |
Unexpected end of file - int32 expected |
18 |
Halted |
0 ms |
0 KB |
- |