Submission #873945

# Submission time Handle Problem Language Result Execution time Memory
873945 2023-11-16T05:18:35 Z Faisal_Saqib The Collection Game (BOI21_swaps) C++17
25 / 100
50 ms 1100 KB
//
// --- Sample implementation for the task swaps ---
//
// To compile this program with the sample grader, place:
//     swaps.h swaps_sample.cpp sample_grader.cpp
// in a single folder and run:
//     g++ swaps_sample.cpp sample_grader.cpp
// in this folder.
//
#include "swaps.h"
#include <iostream>
#include <set>
#include <vector>
using namespace std;
int DNC(vector<int>& next)
{
    if(next.size()==1)
        return next[0];
    vector<int> fop;
    for(int i=0;(i+1)<next.size();i+=2)
        schedule(next[i],next[i+1]);
    auto pk=visit();
    for(int i=0,j=0;i<next.size();i+=2,j++)
    {
        if((i+1)<next.size())
        {
            if(pk[j])
                fop.push_back(next[i]);
            else
                fop.push_back(next[i+1]);
        }
        else
            fop.push_back(next[i]);
    }
    return DNC(fop);
}
void solve(int n, int v) {
    vector<int> ap1;
    set<int> ful;
    for(int i=1;i<=n;i++)
        ful.insert(i);
    for(int i=1;i<=n;i++)
    {
        vector<int> ap;
        for(auto i:ful)
            ap.push_back(i);
        ap1.push_back(DNC(ap));
        ful.erase(ap1.back());
    }
    answer(ap1);
}

Compilation message

swaps.cpp: In function 'int DNC(std::vector<int>&)':
swaps.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i=0;(i+1)<next.size();i+=2)
      |                 ~~~~~^~~~~~~~~~~~
swaps.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i=0,j=0;i<next.size();i+=2,j++)
      |                     ~^~~~~~~~~~~~
swaps.cpp:25:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         if((i+1)<next.size())
      |            ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 4 ms 612 KB Correct
3 Correct 14 ms 452 KB Correct
4 Correct 46 ms 728 KB Correct
5 Correct 47 ms 724 KB Correct
6 Correct 46 ms 720 KB Correct
7 Correct 45 ms 488 KB Correct
8 Correct 48 ms 720 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 3 ms 444 KB Correct
3 Correct 17 ms 452 KB Correct
4 Correct 47 ms 472 KB Correct
5 Correct 48 ms 712 KB Correct
6 Correct 46 ms 464 KB Correct
7 Correct 47 ms 964 KB Correct
8 Correct 48 ms 724 KB Correct
9 Runtime error 17 ms 716 KB Execution killed with signal 13
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 612 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 612 KB Correct
3 Correct 0 ms 344 KB Correct
4 Correct 4 ms 612 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 344 KB Correct
3 Correct 15 ms 456 KB Correct
4 Correct 44 ms 720 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 344 KB Correct
3 Correct 15 ms 456 KB Correct
4 Correct 44 ms 720 KB Correct
5 Correct 0 ms 344 KB Correct
6 Correct 4 ms 436 KB Correct
7 Correct 15 ms 604 KB Correct
8 Correct 50 ms 1100 KB Correct
9 Correct 45 ms 724 KB Correct
10 Correct 45 ms 472 KB Correct
11 Correct 46 ms 716 KB Correct
12 Correct 50 ms 980 KB Correct
13 Correct 0 ms 344 KB Correct
14 Correct 4 ms 612 KB Correct
15 Correct 14 ms 456 KB Correct
16 Correct 48 ms 724 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 600 KB Correct
3 Correct 17 ms 456 KB Correct
4 Correct 44 ms 472 KB Correct
5 Runtime error 10 ms 472 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 600 KB Correct
3 Correct 17 ms 456 KB Correct
4 Correct 44 ms 472 KB Correct
5 Runtime error 10 ms 472 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 612 KB Correct
3 Correct 15 ms 452 KB Correct
4 Correct 44 ms 472 KB Correct
5 Runtime error 10 ms 468 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 612 KB Correct
3 Correct 15 ms 452 KB Correct
4 Correct 44 ms 472 KB Correct
5 Runtime error 10 ms 468 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 500 KB Correct
3 Correct 15 ms 456 KB Correct
4 Correct 44 ms 724 KB Correct
5 Runtime error 10 ms 720 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 4 ms 500 KB Correct
3 Correct 15 ms 456 KB Correct
4 Correct 44 ms 724 KB Correct
5 Runtime error 10 ms 720 KB Execution killed with signal 13
6 Halted 0 ms 0 KB -