This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
+----------------------------------------------------------------+
| In the name of Allah, the most Gracious and the most Merciful. |
+----------------------------------------------------------------+
Our hearts quake with fear of you
Our hearts wake with love for you
And to Islam we must be true
In everything we think and do.
--------------------------------
When your heart is breaking
And your pain makes you fall
Remember just remember
Allah Sees it all.
*/
# include <bits/stdc++.h>
# define FILE
using namespace std;
long long n, A, B, S, L;
vector < pair < long long, long long > > tim;
void Subtask1(){
set < pair < long long , long long> > st;
for( auto tm: tim ){
for( long long i = tm.first; i <= tm.second; i ++ ){
st.insert({(i+i/B)%A, i%B});
}
}
cout << st.size();
exit( 0 );
}
int main(){
# ifdef FILEs
freopen( "input.txt", "r", stdin );
freopen( "output.txt", "w", stdout );
# endif
ios_base::sync_with_stdio(false);
cin >> n >> A >> B;
for( int i = 1; i <= n; i ++ ){
long long l, r; cin >> l >> r;
tim.push_back( {l,r} );
S += r - l + 1;
L = max( L, l );
}
if( S <= 1000000)Subtask1();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |