Submission #984350

#TimeUsernameProblemLanguageResultExecution timeMemory
984350SmuggingSpunStrange Device (APIO19_strange_device)C++14
10 / 100
240 ms41056 KiB
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
typedef long long ll;
const int lim = 1e6 + 5;
int n;
ll A, B, S = 0, l[lim], r[lim];
namespace sub1{
	void solve(){
		map<pair<ll, ll>, bool>cnt;
		for(int i = 0; i < n; i++){
			for(ll j = l[i]; j <= r[i]; j++){
				cnt[make_pair((j + j / B) % A, j % B)] = true;
			}
		}
		cout << cnt.size();
	}
}
namespace sub2345678{
	void solve(){
		
	}
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
	cin >> n >> A >> B;
	for(int i = 0; i < n; i++){
		cin >> l[i] >> r[i];
		S += r[i] - l[i] + 1;
	}
	if(S <= 1000000){
		sub1::solve();
	}
	else{
		sub2345678::solve();
	}
}

Compilation message (stderr)

strange_device.cpp: In function 'int main()':
strange_device.cpp:27:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |   freopen(taskname".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...