Submission #252117

# Submission time Handle Problem Language Result Execution time Memory
252117 2020-07-24T08:58:25 Z Sugardorj Strange Device (APIO19_strange_device) C++14
0 / 100
2385 ms 63108 KB
#include <bits/stdc++.h>
using namespace std;
long long i,j,a,b,tt;
long long x,r,m,n,s,t,k,l,y,z,v=234560;
set <pair<long long,long long>> p,c,d,e;
int main(){
    cin >> n>>a>>b;
    if (b > 1){
        return 0;
    }
    if (a%2 == 0)
        a/=2;
    for (i = 0; i<n; i ++){
        cin >>x>>y;
        if (y-x+1>=a){
            cout << a;
            return 0;
        }
        x%=a;
        y%=a;
        if (x <=y){
            p.insert({x,y});
        }
        else {
            p.insert({0,y});
            p.insert({x,a-1});
        }
    }
    t = 0;
    while (p.size()){
        auto u=*p.begin();
        p.erase(*p.begin());
        x=u.first;
        y=u.second;
        t=max(t,x-1);
        s+=max(y-t,0ll);
        t=max(y,t);
    }
    cout << s;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 2385 ms 63108 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 2385 ms 63108 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 2385 ms 63108 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -