Submission #569819

#TimeUsernameProblemLanguageResultExecution timeMemory
569819DarkMatterStrange Device (APIO19_strange_device)C++14
10 / 100
5081 ms524288 KiB
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using std::chrono::high_resolution_clock;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int>pi;
typedef pair<ll, ll>pl;
typedef vector<pi>vpi;
typedef vector<pl>vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string> vs;
const double PI = acos(-1);
const int oo = 1e9 + 7;
const int MOD = 1e9 + 7;
const int N = 1e6 + 1;
#define endl '\n'
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define read(v) for (auto& it : v) scanf("%d", &it);
#define readL(v) for (auto& it : v) scanf("%lld", &it);
#define print(v) for (auto it : v) printf("%d ", it); puts("");
#define printL(v) for (auto it : v) printf("%lld ", it); puts("");
auto Time() {
	return high_resolution_clock::now();
}
void solve() {
	ll n, a, b;
	scanf("%lld %lld %lld", &n, &a, &b);
	set<pl>st;
	while (n--) {
		ll l, r;
		scanf("%lld %lld", &l, &r);
		while (l <= r) {
			ll x = ((l + l / b) % a), y = (l % b);
			st.insert({ x,y });
			l++;
		}
	}
	printf("%d\n", st.size());
}
int t = 1;
int main() {
//#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//#endif
	//scanf("%d", &t);
	while (t--) solve();
}

Compilation message (stderr)

strange_device.cpp: In function 'void solve()':
strange_device.cpp:43:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wformat=]
   43 |  printf("%d\n", st.size());
      |          ~^     ~~~~~~~~~
      |           |            |
      |           int          std::set<std::pair<long long int, long long int> >::size_type {aka long unsigned int}
      |          %ld
strange_device.cpp:32:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |  scanf("%lld %lld %lld", &n, &a, &b);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |   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...