# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
104280 | 2019-04-04T17:10:21 Z | janchomath | Fish (IOI08_fish) | C++14 | 3000 ms | 13432 KB |
#include<bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back using namespace std; ll n,k,m,dp[500005],sum[500005],last[500005],ans,cur,raod[500005]; pair<ll,ll>a[500005]; ll pw(ll a,ll b){ ll xar = a; ll ans = 1; while(b>0){ if(b%2==1)ans=(ans*xar)%m; b/=2; xar=(xar*xar)%m; } return ans%m; } int main(){ cin >> n >> k >> m; for(int i=2; i<m; i++){ if(m % i == 0){ while(true); } } for(int i=1; i<=n; i++){ cin >> a[i].f >> a[i].s; } sort(a+1,a+n+1); cur = 1LL; for(int i=1; i<=n; i++){ ll l = 1,r = i - 1,mid,ind = 0; while(r >= l){ mid = (l + r) / 2; if(2 * a[mid].f <= a[i].f){ l = mid + 1; ind = mid; } else { r = mid - 1; } } raod[a[i].s]++; cur = cur * pw(raod[a[i].s],m - 2LL); cur %= m; dp[i] = cur - sum[a[i].s]; dp[i] += m; dp[i] %= m; ans += dp[i]; ans %= m; sum[a[i].s] += dp[i]; sum[a[i].s] %= m; cur *= (raod[a[i].s] + 1LL); cur %= m; } cout << ans << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3019 ms | 256 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3083 ms | 384 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3008 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3038 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3017 ms | 512 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 588 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 227 ms | 5148 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3088 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3042 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3005 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3034 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3045 ms | 384 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 763 ms | 12492 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3011 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 722 ms | 13432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3018 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3017 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |