답안 #503167

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
503167 2022-01-07T12:15:00 Z leinad2 Minerals (JOI19_minerals) C++17
컴파일 오류
0 ms 0 KB
#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>A;
vector<vector<int> >v;
int a;
void solve()
{
    bool flag=true;print(v);
    for(int i=0;i<v.size();i++)if(v[i].size()>=2)flag=false;
    if(flag)return;
    int sz=0;
    for(int i=0;i<v.size();i++)
    {
        if(v[i].size()==1)
        {
            sz++;
            continue;
        }
        if(i%2==0)
        {
            for(int j=sz+(v[i].size()+1)/2;j<sz+v[i].size();j++)a=Query(A[j]);
        }
        else
        {
            for(int j=sz;j<sz+(v[i].size()+1)/2;j++)a=Query(A[j]);
        }
        sz+=v[i].size();
    }
    vector<vector<int> >V;
    for(int i=0;i<v.size();i++)
    {
        vector<int>Fi, Se;
        if(v[i].size()==1)
        {
            V.push_back(v[i]);
            continue;
        }
        for(auto p:v[i])
        {
            int b=Query(p);
            if(a!=b)Se.push_back(p);
            else Fi.push_back(p);
            a=b;
        }
        V.push_back(Fi);
        V.push_back(Se);
    }
    v=V;
    solve();
}
void Solve(int N)
{
    vector<int>A, B;
    for(int i=1;i<=2*N;i++)
    {
        int b=Query(i);
        if(a!=b)A.push_back(i);
        else B.push_back(i);
        a=b;
    }
    ::A=A;
    v={B};
    solve();
    vector<int>ans;
    for(int i=0;i<v.size();i++)if(v[i].size())ans.push_back(v[i][0]);
    for(int i=0;i<N;i++)Answer(A[i], ans[i]);
}

Compilation message

minerals.cpp: In function 'void solve()':
minerals.cpp:9:20: error: 'print' was not declared in this scope; did you mean 'printf'?
    9 |     bool flag=true;print(v);
      |                    ^~~~~
      |                    printf
minerals.cpp:10:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i=0;i<v.size();i++)if(v[i].size()>=2)flag=false;
      |                 ~^~~~~~~~~
minerals.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
minerals.cpp:22:45: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for(int j=sz+(v[i].size()+1)/2;j<sz+v[i].size();j++)a=Query(A[j]);
      |                                            ~^~~~~~~~~~~~~~~
minerals.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             for(int j=sz;j<sz+(v[i].size()+1)/2;j++)a=Query(A[j]);
      |                          ~^~~~~~~~~~~~~~~~~~~~~
minerals.cpp:31:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:66:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |     for(int i=0;i<v.size();i++)if(v[i].size())ans.push_back(v[i][0]);
      |                 ~^~~~~~~~~