Submission #781740

# Submission time Handle Problem Language Result Execution time Memory
781740 2023-07-13T10:30:59 Z devariaota Strange Device (APIO19_strange_device) C++17
0 / 100
5000 ms 405456 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a,b;
ll l[1000005],r[1000005];
set<pair<ll,ll>> st;
map<pair<ll,ll>,ll> vis;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n>>a>>b;
    ll s=0;
    for (int i=1;i<=n;i++){
        cin>>l[i]>>r[i];
        s+=(r[i]-l[i])+1;
    }
    ll ans=0;
    if (s<1000005){
        for (int i=1;i<=n;i++){
            for (int j=l[i];j<=r[i];j++){
                if (vis[{(j+j/b)%a,j%b}]!=1){
                    vis[{(j+j/b)%a,j%b}]=1;
                    ans++;
                }
            }
        }
        cout<<ans;
    }
    // else if ()
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 5050 ms 405456 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 5084 ms 60584 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 224 ms 15868 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 224 ms 15868 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Incorrect 224 ms 15868 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 26 ms 2492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 5050 ms 405456 KB Time limit exceeded
3 Halted 0 ms 0 KB -