제출 #1267489

#제출 시각아이디문제언어결과실행 시간메모리
1267489hoa208Strange Device (APIO19_strange_device)C++20
0 / 100
1 ms840 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++) #define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--) #define pa pair<ll, ll> #define fi first #define se second #define bit(mask, j) ((mask >> j) & 1) const ll mod = 1e9 + 7; const ll INF = 1e18; //-------------------------------------------------------------------- ll n, A, B; map<pa, bool> mp; ll a[10000]; void hbmt() { cin >> n >> A >> B; ll cnt = 0; // if(n == 1) { // ll l, r; // cin >> l >> r; // ll bcnn = A*B / __gcd(A, B); // } ll res = A * (B + 1) / __gcd(A, B + 1); res = res / (B + 1) * B; FOR(i, 1, n) { ll l, r; cin >> l >> r; ll x = l % res, y = r % res; if(r - l + 1 >= res) { cout << res; return; } if(x <= y) { FOR(j, x, y) a[j] = 1; } else { FOR(j, 0, x) a[j] = 1; FOR(j, y, res - 1) a[j] = 1; } } FOR(i, 0, res - 1) cnt += a[i]; cout << cnt; } int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); #define NAME "hbmt" if(fopen(NAME".inp", "r")) { freopen(NAME".inp", "r", stdin); freopen(NAME".out", "w", stdout); } //int t;cin>>t;while(t--) hbmt(); return 0; }

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

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