Submission #440340

# Submission time Handle Problem Language Result Execution time Memory
440340 2021-07-02T06:49:02 Z den_tar Strange Device (APIO19_strange_device) C++14
15 / 100
5000 ms 524292 KB
#include <bits/stdc++.h>

using namespace std;

#define fast ios_base::sync_with_stdio();cin.tie();cout.tie();
#define en cout<<endl;
#define ops cout<<"ops"<<endl;
#define line cout<<"---------------------------"<<endl;
#define fi first
#define se second

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pllll;
typedef string str;

const ll DIM = 6e4 + 7;
const ll DIMM = 1e2 + 7;
const ll DDIM = 7;
const ll INF = 1e18 + 7;
const ll X = 1e5 + 7;
const ll BS = 2e5 + 7;
const ll AS = 26 + 7;
const ll MODULO = 1e9 + 7;

ll nt,n,m,k,q;

ll val,val1;

ll A,B;
ll l,r;
ll x,y,t;

ll res;

set<pllll> s;

int main()
{
    fast;
    //ll x1,y1,x2,y2;

    cin>>n>>A>>B;

    if(n==1){
     cin>>l>>r;

     res=(r-l+1)/B;

     if(res>=A){
      res=A;
      res*=B;
     }
     else res=r-l+1;

     cout<<res<<endl;

     return 0;
    }

    for(int i=1;i<=n;i++){

     cin>>l>>r;

     for(ll i=l;i<=r;i++){

      y=i%B;
      x=(i+i/B)%A;

      s.insert({x,y});

     }
    }

    cout<<s.size()<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 62 ms 12200 KB Output is correct
3 Correct 83 ms 17880 KB Output is correct
4 Correct 2 ms 844 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 444 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 8 ms 1168 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 47 ms 6980 KB Output is correct
16 Correct 40 ms 6604 KB Output is correct
17 Correct 173 ms 6596 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 157 ms 32140 KB Output is correct
3 Correct 217 ms 32008 KB Output is correct
4 Correct 177 ms 30528 KB Output is correct
5 Execution timed out 5022 ms 62404 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1787 ms 62996 KB Output is correct
3 Runtime error 2216 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1787 ms 62996 KB Output is correct
3 Runtime error 2216 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1787 ms 62996 KB Output is correct
3 Runtime error 2216 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 1696 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 62 ms 12200 KB Output is correct
3 Correct 83 ms 17880 KB Output is correct
4 Correct 2 ms 844 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 444 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 8 ms 1168 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 47 ms 6980 KB Output is correct
16 Correct 40 ms 6604 KB Output is correct
17 Correct 173 ms 6596 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 157 ms 32140 KB Output is correct
26 Correct 217 ms 32008 KB Output is correct
27 Correct 177 ms 30528 KB Output is correct
28 Execution timed out 5022 ms 62404 KB Time limit exceeded