QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#654983#1834. Eulerian?jiangzhihuiTL 3ms3696kbC++20964b2024-10-18 23:33:582024-10-18 23:33:59

Judging History

你现在查看的是最新测评结果

  • [2024-10-18 23:33:59]
  • 评测
  • 测评结果:TL
  • 用时:3ms
  • 内存:3696kb
  • [2024-10-18 23:33:58]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1919810;
typedef long long ll;
typedef pair<ll,ll> PII;
int n,m,k;
int a[N],b[N];
char s[N];
vector<PII> e[N];
int d[N];
bool tf[N];


int query(vector<int> &v){
    cout<<"? "<<v.size()<<" ";
    for(auto x:v) cout<<x<<" ";
    cout<<endl;
    int x;
    cin>>x;
    return x;
}

mt19937 rnd(time(0));
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    vector<int> v;
    for(int i=1;i<=n;i++) v.push_back(i);
    ll tot=query(v);
    set<int> se;
    for(int i=1;i<=n;i++) se.insert(i);
    int t1;
    for(int i=1;i<=59;i++){
        vector<int> v;
        while(!se.count(t1))
        t1=rnd()%n+1;
        for(int j=1;j<=n;j++){
            if(j==t1) continue;
            v.push_back(j);
        }
        if((tot-query(v)&1)){
            cout<<"! NO"<<endl;
            return 0;
        }
        se.erase(se.find(t1));
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 3696kb

input:

3
2
1

output:

? 3 1 2 3 
? 2 2 3 
! NO

result:

ok correct

Test #2:

score: -100
Time Limit Exceeded

input:

3
3
1
1
1

output:

? 3 1 2 3 
? 2 2 3 
? 2 1 3 
? 2 1 2 

result: