Submission #409672

#TimeUsernameProblemLanguageResultExecution timeMemory
409672Batorgil952Strange Device (APIO19_strange_device)C++14
10 / 100
5068 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;
	
	scanf("%lld",&n);
	scanf("%lld",&q);
	scanf("%lld",&p);
	
	s=0;
	for(i=1; i<=n; i++){
		scanf("%lld",&x);
		scanf("%lld",&y);
		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++;
		}
	}
	
	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:17:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%lld",&x);
      |   ~~~~~^~~~~~~~~~~
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",&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...