Submission #204963

#TimeUsernameProblemLanguageResultExecution timeMemory
204963Leonardo_PaesFish (IOI08_fish)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; #define f first #define s second const int maxn = 5e5+10, maxk = 30; int qtd[maxn][maxk], mark[maxk]; int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int n, k, m; cin >> n >> k >> m; vector<pii> v(n+1); vector<int> ans(n+1); for(int i=1; i<=n; i++){ cin >> v[i].f >> v[i].s; } sort(v.begin(), v.end()); for(int i=1; i<=n; i++){ ans[i] = 1; qtd[i][v[i].s]++; memset(mark, 0, sizeof mark); mark[v[i].s] = 1; for(int j=1; j<i; j++){ if(!mark[v[j].s] and v[i].f >= v[j].f + v[j].f){ mark[v[j].s] = j; ans[i] = (ans[i] + ans[j] - qtd[v[i].s] + 1)%m; for(int q=1; q<=k; q++){ qtd[i][q] += qtd[j][q]; } } } //cout << ans[i] << " " << qtd[i][v[i].s] << "\n"; } cout << ans[n] << "\n"; return 0; }

Compilation message (stderr)

fish.cpp: In function 'int main()':
fish.cpp:43:43: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' and 'int [30]' to binary 'operator-'
                 ans[i] = (ans[i] + ans[j] - qtd[v[i].s] + 1)%m;