Submission #877532

# Submission time Handle Problem Language Result Execution time Memory
877532 2023-11-23T09:43:00 Z AndrijaM Art Collections (BOI22_art) C++17
0 / 100
0 ms 348 KB
#include "art.h"
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5;
const int mod = 1e9+7;
const int logn=30;

void solve(int n)
{
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        v.push_back(i+1);
    }
    int prev=publish(v);
    int p=0;
    swap(v[0],v[1]);
    for(int i=0;i<n;i++)
    {
        while(true)
        {
            int kolku=publish(v);
            if(kolku>prev)
            {
                swap(v[i],v[p]);
                break;
            }
            int koj=v[i]+1;
            int P=-1;
            for(int pos=0;pos<v.size();pos++)///moze i so mapa da najdeme kade e vo log(n)
            {
                if(v[pos]==koj)
                {
                    P=pos;
                    break;
                }
            }
            p=P;
            swap(v[i],v[P]);
        }
    }
    answer(v);
    /// publish(order);
    /// answer(order);
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:32:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for(int pos=0;pos<v.size();pos++)///moze i so mapa da najdeme kade e vo log(n)
      |                           ~~~^~~~~~~~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Not correct
2 Halted 0 ms 0 KB -