답안 #956026

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956026 2024-03-31T19:55:18 Z MarwenElarbi Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include "dango3.h"

#include <vector>

namespace {

int variable_example = 1;

} 
set<int> colors[25];
void Solve(int N, int M){
    int n=N;
    int m=M;
    //cout <<n<<" "<<m<<endl;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            int l=-1;
            int r=m-1;
            while(r-l>1){
                int mid=(r+l)/2;
                vector<int> cur;
                for (int k = 1; k <= n*m; ++k)
                {
                    if(k==i*m+j+1) continue;
                    if(colors[mid].count(k)) continue;
                    cur.push_back(k); 
                }
                int res=Query(cur);
                if(m-res>1) l=mid;
                else r=mid;
            }
            //for(auto u:colors[0]) cout <<u<<" ";
            //cout <<endl;
            vector<int> cur;
            for (int k = 1; k <= n*m; ++k)
            {
                if(k==i*m+j+1) continue;
                if(colors[r].count(k)) continue;
                cur.push_back(k); 
            }
            //cout <<r<<" "<<Query(cur)<<" "<<i*m+j+1<<" "<<i<<" "<<j<<endl;
            colors[r].insert(i*m+j+1);
        }
    }
    vector<int> ans[m];
    for (int i = 0; i < m; ++i)
    {
        //cout <<colors[i].size()<<endl;
        for(auto u:colors[i]) ans[i].push_back(u); 
    }
    for (int i = 0; i < m; ++i)
    {
        Answer(ans[i]);
    }
}

Compilation message

dango3.cpp:10:1: error: 'set' does not name a type
   10 | set<int> colors[25];
      | ^~~
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:23:17: error: 'vector' was not declared in this scope
   23 |                 vector<int> cur;
      |                 ^~~~~~
dango3.cpp:23:17: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
dango3.cpp:23:24: error: expected primary-expression before 'int'
   23 |                 vector<int> cur;
      |                        ^~~
dango3.cpp:27:24: error: 'colors' was not declared in this scope
   27 |                     if(colors[mid].count(k)) continue;
      |                        ^~~~~~
dango3.cpp:28:21: error: 'cur' was not declared in this scope
   28 |                     cur.push_back(k);
      |                     ^~~
dango3.cpp:30:31: error: 'cur' was not declared in this scope
   30 |                 int res=Query(cur);
      |                               ^~~
dango3.cpp:36:13: error: 'vector' was not declared in this scope
   36 |             vector<int> cur;
      |             ^~~~~~
dango3.cpp:36:13: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
dango3.cpp:36:20: error: expected primary-expression before 'int'
   36 |             vector<int> cur;
      |                    ^~~
dango3.cpp:40:20: error: 'colors' was not declared in this scope
   40 |                 if(colors[r].count(k)) continue;
      |                    ^~~~~~
dango3.cpp:41:17: error: 'cur' was not declared in this scope
   41 |                 cur.push_back(k);
      |                 ^~~
dango3.cpp:44:13: error: 'colors' was not declared in this scope
   44 |             colors[r].insert(i*m+j+1);
      |             ^~~~~~
dango3.cpp:47:5: error: 'vector' was not declared in this scope
   47 |     vector<int> ans[m];
      |     ^~~~~~
dango3.cpp:47:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
dango3.cpp:47:12: error: expected primary-expression before 'int'
   47 |     vector<int> ans[m];
      |            ^~~
dango3.cpp:51:20: error: 'colors' was not declared in this scope
   51 |         for(auto u:colors[i]) ans[i].push_back(u);
      |                    ^~~~~~
dango3.cpp:51:31: error: 'ans' was not declared in this scope
   51 |         for(auto u:colors[i]) ans[i].push_back(u);
      |                               ^~~
dango3.cpp:55:16: error: 'ans' was not declared in this scope
   55 |         Answer(ans[i]);
      |                ^~~
dango3.cpp: At global scope:
dango3.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~