제출 #232302

#제출 시각아이디문제언어결과실행 시간메모리
232302Leonardo_Paes앵무새 (IOI11_parrots)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"

using namespace std;

void encode(int n , int m[] ){
    set<vector<int>> s;

    int qtd = 0;

    map<int, vector<int>> arr;

    for(int i=0; i<4; i++){
        for(int j=0; j<4; j++){
            for(int k=0; k<4; k++){
                for(int l=0; l<4; l++){
                    for(int m=0; m<4; m++){
                        for(int n=0; n<4; n++){
                            for(int o=0; o<4; o++){
                                for(int p=0; p<4; p++){
                                    for(int q=0; q<4; q++){
                                        for(int r=0; r<4; r++){
                                            vector<int> x;
                                            x.push_back(i);
                                            x.push_back(j);
                                            x.push_back(k);
                                            x.push_back(l);
                                            x.push_back(m);
                                            x.push_back(n);
                                            x.push_back(o);
                                            x.push_back(p);
                                            x.push_back(q);
                                            x.push_back(r);

                                            sort(x.begin(), x.end());

                                            if(s.find(x) == s.end()){
                                                qtd++;
                                                s.insert(x);
                                                arr[qtd] = x;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    for(int i=0; i<n; i++){
        int val = 0;
        for(int j=0; j<6; j++){
            if(m[i] & (1<<j)){
                val += (1<<(j+3));
            }
        }
        for(int j=0; j<10; j++){
            send(val + arr[val][j]);
        }
    }

}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"

using namespace std;

void decode(int n , int l, int m[] ){
    set<vector<int>> s;

    int qtd = 0;

    map<int, vector<int>> arr;
    map<vector<int>, int> ans;

    for(int i=0; i<4; i++){
        for(int j=0; j<4; j++){
            for(int k=0; k<4; k++){
                for(int l=0; l<4; l++){
                    for(int m=0; m<4; m++){
                        for(int n=0; n<4; n++){
                            for(int o=0; o<4; o++){
                                for(int p=0; p<4; p++){
                                    for(int q=0; q<4; q++){
                                        for(int r=0; r<4; r++){
                                            vector<int> x;
                                            x.push_back(i);
                                            x.push_back(j);
                                            x.push_back(k);
                                            x.push_back(l);
                                            x.push_back(m);
                                            x.push_back(n);
                                            x.push_back(o);
                                            x.push_back(p);
                                            x.push_back(q);
                                            x.push_back(r);

                                            sort(x.begin(), x.end());

                                            if(s.find(x) == s.end()){
                                                qtd++;
                                                s.insert(x);
                                                arr[qtd] = x;
                                                ans[x] = qtd;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    vector<int> x[65];

    for(int i=0; i<l; i++){
        for(int j=0; j<8; j++){
            int val = 0, pos = 0;
            if(j<3){
                val += m[i] & (1<<j);
            }
            else{
                pos += m[i] & (1<<j);
                x[pos].push_back(val);
            }
        }
    }

    for(int i=1; i<64; i++){
        sort(x[i].begin(), x[i].end());
        send(arr[x]);
    }

}

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

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:73:17: error: ambiguous overload for 'operator[]' (operand types are 'std::map<int, std::vector<int> >' and 'std::vector<int> [65]')
         send(arr[x]);
                 ^
In file included from /usr/include/c++/7/map:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:81,
                 from decoder.cpp:1:
/usr/include/c++/7/bits/stl_map.h:484:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::vector<int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = int] <near match>
       operator[](const key_type& __k)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_map.h:484:7: note:   conversion of argument 1 would be ill-formed:
decoder.cpp:73:19: error: invalid conversion from 'std::vector<int>*' to 'std::map<int, std::vector<int> >::key_type {aka int}' [-fpermissive]
         send(arr[x]);
                   ^
In file included from /usr/include/c++/7/map:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:81,
                 from decoder.cpp:1:
/usr/include/c++/7/bits/stl_map.h:504:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::vector<int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = int] <near match>
       operator[](key_type&& __k)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
decoder.cpp:73:19: error: invalid conversion from 'std::vector<int>*' to 'std::map<int, std::vector<int> >::key_type {aka int}' [-fpermissive]
         send(arr[x]);
                   ^
decoder.cpp:73:9: error: 'send' was not declared in this scope
         send(arr[x]);
         ^~~~
decoder.cpp:73:9: note: suggested alternative: 'setns'
         send(arr[x]);
         ^~~~
         setns