Submission #424722

#TimeUsernameProblemLanguageResultExecution timeMemory
424722SAADStrange Device (APIO19_strange_device)C++17
10 / 100
5053 ms524292 KiB
#define F first
#define S second
#define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1))
#define pb push_back
#define Fbitl __builtin_ffs
#define bit1 __builtin_popcount
#define pi acos(-1)
//#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
map <pair<ll,ll>,bool> mp ;
int main(){
   ios_base::sync_with_stdio(0);cin.tie(0);
   ll n , l , r , a , b , c = 0 , res = 0 ;
   cin >> n >> a >> b;
   for (int i=0;i<n;i++) {
       cin >> l >> r ;
       for (ll j=l;j<=r;j++) {
           ll x = (j+(j/b)) % a , y = j%b  ;
           if ( !mp[{x,y}] ) {
               res++;
               mp[{x,y}] = true ;
           }
       }
   }
   cout << res ;
   return 0;
}

Compilation message (stderr)

strange_device.cpp: In function 'int main()':
strange_device.cpp:31:27: warning: unused variable 'c' [-Wunused-variable]
   31 |    ll n , l , r , a , b , c = 0 , res = 0 ;
      |                           ^
#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...