제출 #382930

#제출 시각아이디문제언어결과실행 시간메모리
382930abil이상한 기계 (APIO19_strange_device)C++14
5 / 100
377 ms16876 KiB
#include <bits/stdc++.h> #define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); #define fr first #define sc second #define pb push_back #define mk make_pair #define all(s) s.begin(),s.end() #define int long long using namespace std; const int N = (1e6 + 12); const int mod = (1e9 + 7); const int inf = (1e18 + 7); int l[N], r[N]; main(){ SPEEDUP; int n, A, B; cin >> n >> A >> B; // for(int i = 1; i <= 25; i++){ // cout << i << " "; // } // cout << endl; // vector<int > vec; // for(int i = 0;i <= 25; i++){ // cout << ((i + (i + B - 1) / B)) << " "; // vec.pb(((i + (i + B - 1) / B))); // } // cout << endl; // for(int i = 0;i <= 30; i++){ // cout << (i % B) << " "; // } // cout << endl; // for(auto to : vec){ // cout << to % A << " "; // } // cout << endl; for(int i = 1; i <= n; i++){ cin >> l[i] >> r[i]; } int x; int L = r[1] - l[1] + 1ll; if(0 == (A % (B + 1ll))){ if(inf / B >= (A / (B + 1ll))){ x = B * (A / (B + 1ll)); } else{ cout << L << endl; return 0; } } else{ if(inf / A >= B){ x = A * B; } else{ cout << L << endl; return 0; } } if(x <= L){ cout << x << endl; return 0; } int ans; if(r[1] % x >= l[1] % x){ ans = r[1] % x - l[1] % x + 1; } else{ ans = r[1] % x + 1 + (x - l[1] % x + 1); } cout << ans << endl; }

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

strange_device.cpp:19:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main(){
      |      ^
#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...