Submission #204962

# Submission time Handle Problem Language Result Execution time Memory
204962 2020-02-27T15:10:55 Z Leonardo_Paes Fish (IOI08_fish) C++17
0 / 100
3000 ms 15736 KB
#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])%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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 504 KB Output is correct
2 Incorrect 6 ms 504 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 508 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 888 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3071 ms 12672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3075 ms 11440 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3077 ms 15716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3086 ms 14328 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3082 ms 8232 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 3083 ms 8996 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 3080 ms 15736 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3090 ms 12264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3084 ms 8824 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3074 ms 9808 KB Time limit exceeded
2 Halted 0 ms 0 KB -