Submission #279328

#TimeUsernameProblemLanguageResultExecution timeMemory
279328Nodir_BobievStrange Device (APIO19_strange_device)C++17
10 / 100
384 ms32312 KiB
/*
+----------------------------------------------------------------+
| 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...