답안 #892544

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892544 2023-12-25T13:30:14 Z vjudge1 Super Dango Maker (JOI22_dango3) C++17
100 / 100
512 ms 852 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
 
void Solve(int n,int m){
    queue < pair < vector <int> ,int >  > q;
    vector <int> in;
    vector <vector <int> > ans;
    for(int i=1;i<=n*m;i++){
        in.push_back(i);
    }
    q.push({in,m});
    while(!q.empty()){
        vector <int> v=q.front().first;
        int k=q.front().second;
        q.pop();
        if(k<=1){
            ans.push_back(v);
        }
        else{
            vector <int> used(v.size());
            for(int i=0;i<v.size();i++){
                used[i]=1;
                vector <int> x;
                for(int j=0;j<v.size();j++){
                    if(used[j]==0)x.push_back(v[j]);
                }
                if(Query(x)<k/2)used[i]=0;
            }
            vector <int> g1,g2;
            for(int i=0;i<v.size();i++){
                if(used[i]==0)g1.push_back(v[i]);
                else g2.push_back(v[i]);
            }
            q.push({g1,k/2});
            if(k%2==1)q.push({g2,k/2+1});
            else q.push({g2,k/2});
            
        }
        
    }
    for(auto x : ans){
        Answer(x);
    }
    return;
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:22:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for(int i=0;i<v.size();i++){
      |                         ~^~~~~~~~~
dango3.cpp:25:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |                 for(int j=0;j<v.size();j++){
      |                             ~^~~~~~~~~
dango3.cpp:31:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(int i=0;i<v.size();i++){
      |                         ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 620 KB Output is correct
2 Correct 113 ms 604 KB Output is correct
3 Correct 134 ms 852 KB Output is correct
4 Correct 141 ms 604 KB Output is correct
5 Correct 110 ms 620 KB Output is correct
6 Correct 118 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 456 ms 744 KB Output is correct
2 Correct 433 ms 604 KB Output is correct
3 Correct 511 ms 604 KB Output is correct
4 Correct 512 ms 852 KB Output is correct
5 Correct 429 ms 600 KB Output is correct
6 Correct 427 ms 740 KB Output is correct