제출 #1040058

#제출 시각아이디문제언어결과실행 시간메모리
1040058Marco_EscandonArt Collections (BOI22_art)C++17
100 / 100
885 ms2020 KiB
#include<bits/stdc++.h>
using namespace std;
#include "art.h"
typedef int ll;
void solve(int n) {
    vector<ll> sol(n,n+2);
    vector<ll> temp;
    for(int i=1; i<=n; i++)
        temp.push_back(i);
    ll a=publish(temp);
    ll b;
    ll p=0;
    for(int i=1; i<n; i++)
    {
        vector<ll> temp2;
        for(int j=1; j<n; j++)
            temp2.push_back(temp[j]);
        temp2.push_back(temp[0]);
        temp=temp2;
        ll b=publish(temp);
        ll t1=((a+b)-(n-1))/2;
        ll t2=a-t1;
        sol[temp.back()-1]=t2;
        a=b;
    }
    vector<ll> sf;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            if(sol[j]==i) sf.push_back(j+1);
        if(sf.size()!=(i+1))
        {
            for(int j=0; j<n; j++)
                if(sol[j]==n+2) sf.push_back(j+1);
        }
    }
    answer(sf);
    return;
}

컴파일 시 표준 에러 (stderr) 메시지

art.cpp: In function 'void solve(int)':
art.cpp:31:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |         if(sf.size()!=(i+1))
      |            ~~~~~~~~~^~~~~~~
art.cpp:11:8: warning: unused variable 'b' [-Wunused-variable]
   11 |     ll b;
      |        ^
art.cpp:12:8: warning: unused variable 'p' [-Wunused-variable]
   12 |     ll p=0;
      |        ^
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...