Submission #821727

# Submission time Handle Problem Language Result Execution time Memory
821727 2023-08-11T14:01:30 Z alvingogo The Collection Game (BOI21_swaps) C++17
0 / 100
1 ms 208 KB
#include "swaps.h"
#include <bits/stdc++.h>
#define fs first
#define sc second
using namespace std;

void solve(int n, int v) {
    vector<int> a(n);
    iota(a.begin(),a.end(),1);
    for(int p=1;p<n;p<<=1){
        for(int k=p;k>=1;k>>=1){
            vector<pair<int,int> > nw;
            for(int j=k%p;j+k<n;j+=2*k){
                for(int i=0;i+j+k<n && i<k;i++){
                    if((i+j)/(p*2) == (i+j+k)/(p*2)){
                        nw.push_back({i+j,i+j+k});
                        schedule(a[i+j],a[i+j+k]);
                    }
                }
            }
            auto h=visit();
            for(int i=0;i<nw.size();i++){
                if(h[i]){
                    swap(a[nw[i].fs],a[nw[i].sc]);
                }
            }
        }
    }
    answer(a);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:22:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for(int i=0;i<nw.size();i++){
      |                         ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -