답안 #602465

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
602465 2022-07-23T06:24:54 Z MrDeboo Art Collections (BOI22_art) C++17
0 / 100
1 ms 208 KB
#include "art.h"
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int>vc(4001,-1);
int sbmt(vector<int>vct){
    int tot=0,a=0;
    vector<int>v;
    for(int i=1;i<=n;i++){
        if(vc[i]==-1)a++;
        else {tot+=a;v.push_back(i);}
    }
    for(auto &i:vct)v.push_back(i);
    return publish(v)-tot;
}
void solve(int N){
    n=N;
    vector<int>v;
    for(int i=1;i<=n;i++)v.push_back(i);
    int a=sbmt(v);
    while(v.size()>1){
        int x=v.back();
        vector<int>vcc={x};
        for(int i=0;i<v.size()-1;i++)vcc.push_back(v[i]);
        int b=sbmt(vcc);
        int y=b-a;
        vector<int>voc;
        for(int i=1;i<=n;i++){
            if(vc[i]==-1)voc.push_back(i);
        }
        for(int i=0;i<voc.size();i++){
            if(i-(voc.size()-i-1)==y){
                vc[voc[i]]=x;
                a-=voc.size()-i-1;
                v.pop_back();
                break;
            }
        }
    }
    vector<bool>bl(n+1);
    for(int i=1;i<=n;i++){
        if(vc[i]!=-1)bl[vc[i]]=1;
    }
    int f=0;
    for(int i=1;i<=n;i++){
        if(!bl[i])f=i;
    }
    for(int i=1;i<=n;i++){
        if(vc[i]==-1)vc[i]=f;
    }
    vector<int>ans;
    for(int i=1;i<=n;i++)ans.push_back(vc[i]);
    answer(ans);
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int i=0;i<v.size()-1;i++)vcc.push_back(v[i]);
      |                     ~^~~~~~~~~~~
art.cpp:31:22: 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<voc.size();i++){
      |                     ~^~~~~~~~~~~
art.cpp:32:34: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |             if(i-(voc.size()-i-1)==y){
      |                ~~~~~~~~~~~~~~~~~~^~~
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) {
      |        ~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -