Submission #432622

#TimeUsernameProblemLanguageResultExecution timeMemory
432622inwbearStrange Device (APIO19_strange_device)C++14
0 / 100
5097 ms524292 KiB
#include <bits/stdc++.h> using namespace std; long long a,b,n,l,r,c1,c2,ans; map<pair<long long,long long>,bool >mp; int main() { scanf("%lld %lld %lld",&n,&a,&b); for(int i=1;i<=n;i++) { scanf("%d %d",&l,&r); for(int ii=l;ii<=r;ii++) { c1=(ii+(ii/b))%a; c2=ii%b; if(!mp[{c1,c2}])mp[{c1,c2}]=true,ans++; } } printf("%lld",ans); }

Compilation message (stderr)

strange_device.cpp: In function 'int main()':
strange_device.cpp:10:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   10 |         scanf("%d %d",&l,&r);
      |                ~^     ~~
      |                 |     |
      |                 int*  long long int*
      |                %lld
strange_device.cpp:10:20: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   10 |         scanf("%d %d",&l,&r);
      |                   ~^     ~~
      |                    |     |
      |                    int*  long long int*
      |                   %lld
strange_device.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%lld %lld %lld",&n,&a,&b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%d %d",&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...