제출 #361921

#제출 시각아이디문제언어결과실행 시간메모리
361921parsabahrami이상한 기계 (APIO19_strange_device)C++17
0 / 100
768 ms63212 KiB
// Call my Name and Save me from The Dark #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pii; #define SZ(x) (int) x.size() #define F first #define S second const int N = 1e6 + 10; ll A, B; int n; set<pii> st; int main() { scanf("%d%lld%lld", &n, &A, &B); ll tof = A / __gcd(A, B + 1), blk; if ((ll) 1e18 / B > tof) blk = (ll) 1e18 + 1; else blk = tof * B; for (int i = 1; i <= n; i++) { ll l, r; scanf("%lld%lld", &l, &r); if (r - l + 1 >= blk) return !printf("%lld\n", blk); if (l % blk <= r % blk) st.insert({l % blk, -(r % blk)}); else st.insert({0, -(r % blk)}), st.insert({l % blk, -(blk - 1)}); } ll mx = -1, ret = 0; for (pii x : st) { ret += max(0ll, -x.S - max(mx + 1, x.F) + 1); mx = max(mx, -x.S); } printf("%lld\n", ret); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

strange_device.cpp: In function 'int main()':
strange_device.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |     scanf("%d%lld%lld", &n, &A, &B);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:22:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |         ll l, r; 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...