Submission #409677

#TimeUsernameProblemLanguageResultExecution timeMemory
409677Batorgil952Strange Device (APIO19_strange_device)C++14
0 / 100
5051 ms524292 KiB
#include<bits/stdc++.h> #define mp make_pair using namespace std; map< pair< int, int >, int > M; int main(){ long long n, q, p, i, j, x, y, a, b, s, P; scanf("%lld",&n); scanf("%lld",&q); scanf("%lld",&p); s=0; P=0; for(i=1; i<=n; i++){ scanf("%lld",&x); scanf("%lld",&y); if(P==0){ if(y-x+1>=p*q) s=p*q; else{ for(j=x; j<=y; j++){ a=(j+j/p)%q; b=j%p; M[mp(a, b)]++; if(M[mp(a, b)]==1) s++; } } if(s==p*q) P++; } } cout<<s<<endl; return 0; }

Compilation message (stderr)

strange_device.cpp: In function 'int main()':
strange_device.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
strange_device.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%lld",&q);
      |  ~~~~~^~~~~~~~~~~
strange_device.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%lld",&p);
      |  ~~~~~^~~~~~~~~~~
strange_device.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%lld",&x);
      |   ~~~~~^~~~~~~~~~~
strange_device.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   scanf("%lld",&y);
      |   ~~~~~^~~~~~~~~~~
#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...