Submission #510629

#TimeUsernameProblemLanguageResultExecution timeMemory
510629amukkalirStrange Device (APIO19_strange_device)C++17
10 / 100
5085 ms524292 KiB
#include <bits/stdc++.h>
using namespace std; 
typedef long long ll; 
#define pii pair<int,int> 
#define fi first 
#define se second 
#define pb push_back 
#define mp make_pair

int n, a, b; 

signed main () {
    scanf("%d %d %d", &n, &a, &b); 
    set<pii> s; 
    for(int i=0; i<n; i++) {
        ll l, r; scanf("%lld %lld", &l, &r); 
        
        for(ll j = l; j <= r; j++) {
            ll x = (j + j/b) % a; 
            ll y = j % b; 
            //cerr << x << " " << y << endl; 
            s.insert(mp(x, y)); 
        }
    }

    ll ans = s.size(); 
    printf("%lld", ans); 
}

Compilation message (stderr)

strange_device.cpp: In function 'int main()':
strange_device.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d %d %d", &n, &a, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:16:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         ll l, r; scanf("%lld %lld", &l, &r);
      |                  ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...