제출 #482082

#제출 시각아이디문제언어결과실행 시간메모리
482082Yazan_AlattarFootball (info1cup20_football)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <utility>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 200007;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int n, k;
map < pair < pair < int, vector <int> >, int > > dp;

int solve(int turn, vector <int> v, int mn)
{
    int cnt = 0;
    for(int i = 0; i < n; ++i) if(v[i]) ++cnt;
    if(!cnt) return (turn % 2 ? 2 : 1);
    int &ret = dp[{{turn, v}, mn}];
    if(ret) return ret;
    for(int i = 0; i < n; ++i){
        for(int j = 1; j <= min(mn, v[i]); ++i){
            v[i] -= j;
            int res = solve(turn + 1, v, j);
            if(ret == -1) ret = res;
            if(turn % 2 && ret != 1) ret = res;
            else if(turn % 2 == 0 && ret != 2) ret = res;
            v[i] += j;
        }
    }
    return ret;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while(t--){
        cin >> n >> k;
        vector <int> v;
        for(int i = 1; i <= n; ++i){
            int x;
            cin >> x;
            v.pb(x);
        }
        cout << solve(1, v, 3) % 2;
    }
    return 0;
}
// Don't forget special cases. (n = 1?)
// Look for the constraints. (Runtime array? overflow?)

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

football.cpp:27:48: error: wrong number of template arguments (1, should be at least 2)
   27 | map < pair < pair < int, vector <int> >, int > > dp;
      |                                                ^
In file included from /usr/include/c++/10/map:61,
                 from football.cpp:7:
/usr/include/c++/10/bits/stl_map.h:100:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  100 |     class map
      |           ^~~
football.cpp: In function 'int solve(int, std::vector<int>, int)':
football.cpp:34:18: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   34 |     int &ret = dp[{{turn, v}, mn}];
      |                  ^