Submission #1019521

# Submission time Handle Problem Language Result Execution time Memory
1019521 2024-07-11T02:40:58 Z vjudge1 Fish (IOI08_fish) C++17
0 / 100
428 ms 65536 KB
#include<bits/stdc++.h>
using namespace std;
int cntof[7010][7010],mod=0,ans,cnt[7010],cnt2[7010];
vector<int>S[7010];
void dothestuf(vector<int>bad,int k){
    memcpy(cnt2,cnt,sizeof cnt);
    for(auto f:bad)
        cnt2[f]=0;
    long long x=1;
    for(int i=1;i<=7e3;i++) 
        x=(x*(cnt2[i]+1))%mod;
    ans=(ans+mod+x*k)%mod;
}
vector<int>order;
int main(){
    cin.tie(0)->sync_with_stdio(0);
    int n,k;
    cin>>n>>k>>mod;
    for(int i=1;i<=n;i++){
        int a,b; cin>>a>>b;
        S[b].push_back(a);
    }
    for(int i=1;i<=k;i++)
        sort(S[i].begin(),S[i].end());
    sort(S+1,S+k+1,[](vector<int>a,vector<int>b){
        return a.back()<b.back();
    });
    for(int i=1;i<=k;i++) for(int j=1;j<=k;j++)
        cntof[i][j]=upper_bound(S[j].begin(),S[j].end(),S[i].back()/2)-S[j].begin();
    for(int i=1;i<=k;i++){
        vector<int> v,v2;
        for(int j=i;j++<k;)
            v.push_back(j);
        for(int j=1;j<=k;j++)
            cnt[j]=cntof[i][j];
        dothestuf(v,1);
        for(auto x:v)
            if(cntof[x][i]<=cntof[i][i])
                v2.push_back(x);
            else break;
        dothestuf(v2,-1);
        cnt2[i]--;
        dothestuf(v2,1);
        v.clear();
        dothestuf(v,-1);
        cnt2[i]++;
        dothestuf(v,1);
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Incorrect 3 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Incorrect 78 ms 3268 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 3388 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 342 ms 25432 KB Output is correct
2 Correct 161 ms 8700 KB Output is correct
3 Incorrect 278 ms 18920 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 318 ms 19692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 428 ms 27636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 178 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1880 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 2136 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 3360 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 13648 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 2904 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 12380 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -