답안 #710669

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
710669 2023-03-15T14:40:44 Z alvingogo Super Dango Maker (JOI22_dango3) C++17
100 / 100
2713 ms 620 KB
#include <bits/stdc++.h>
#include "dango3.h"
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;

mt19937 rnd(time(NULL));
void Solve(int n,int m){
    n*=m;
    vector<int> v(n);
    iota(v.begin(),v.end(),1);
    vector<int> vis(n+1);
    auto check=[&](){
        vector<int> zz;
        for(int i=1;i<=n;i++){
            if(!vis[i]){
                zz.push_back(i);
            }
        }
        return Query(zz);
    };
    int uu=n/m;
    while(m--){
        shuffle(v.begin(),v.end(),rnd);
        vector<int> ans;
        int cnt=0;
        for(int j=0;j<v.size();j++){
            if(!vis[v[j]]){
                vis[v[j]]=1;
                if(check()!=m-1){
                    cnt++;
                    ans.push_back(v[j]);
                    if(cnt==uu){
                        break;
                    }
                }
                else{
                    vis[v[j]]=0;
                }
            }
        }
        Answer(ans);
        vector<int> l;
        for(int j=1;j<=n;j++){
            if(!vis[j]){
                l.push_back(j);
            }
        }
    }
}

/*

g++ -std=gnu++17 -O2 -o grader grader.cpp temp6.cpp
.\grader.exe

*/

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:30:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for(int j=0;j<v.size();j++){
      |                     ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 308 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 340 KB Output is correct
2 Correct 19 ms 340 KB Output is correct
3 Correct 17 ms 380 KB Output is correct
4 Correct 17 ms 340 KB Output is correct
5 Correct 17 ms 340 KB Output is correct
6 Correct 17 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 589 ms 600 KB Output is correct
2 Correct 577 ms 604 KB Output is correct
3 Correct 552 ms 476 KB Output is correct
4 Correct 519 ms 480 KB Output is correct
5 Correct 549 ms 480 KB Output is correct
6 Correct 522 ms 496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2616 ms 604 KB Output is correct
2 Correct 2674 ms 616 KB Output is correct
3 Correct 2552 ms 620 KB Output is correct
4 Correct 2713 ms 620 KB Output is correct
5 Correct 2697 ms 616 KB Output is correct
6 Correct 2621 ms 616 KB Output is correct