problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define deb(x) cout << #x << " " << x << endl; #define fo(i, n) for (int i = 0; i < n; i++) #define Fo(i, k, n) for (int i = k; i < n; i++) #define vi vector<int> #define ii pair<int, int> #define vii vector<ii> #define ll long long #define pb push_back #define endl "\n" #define mp map<int, int> #define F first #define S second #define sz(v) (int)v.size() #define mod 1000000007 void c_p_c() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); // #endif } int main() { c_p_c(); ll n, a, b; cin >> n >> a >> b; ll ans = 0; while (n > 0) { if (n >= a) ans += a; else ans += n; n -= (a + b); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define deb(x) cout << #x << " " << x << endl; #define fo(i, n) for (int i = 0; i < n; i++) #define Fo(i, k, n) for (int i = k; i < n; i++) #define vi vector<int> #define ii pair<int, int> #define vii vector<ii> #define ll long long #define pb push_back #define endl "\n" #define mp map<int, int> #define F first #define S second #define sz(v) (int)v.size() #define mod 1000000007 void c_p_c() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); // #endif } int main() { c_p_c(); ll n, a, b; cin >> n >> a >> b; ll ans = (n / (a + b)) * a; ll rem = n % (a + b); if (rem >= a) ans += a; else ans += rem; cout << ans << endl; return 0; }
replace
34
42
34
40
TLE
p02754
C++
Runtime Error
#include <iostream> #include <string> using namespace std; int main() { int ans; int aa; int n, a, b; cin >> n >> a >> b; aa = n % (a + b); if (aa > a) aa = a; ans = ((n / (a + b)) * a) + aa; cout << ans << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { long int ans; long int aa; long int n, a, b; cin >> n >> a >> b; aa = n % (a + b); if (aa > a) aa = a; ans = ((n / (a + b)) * a) + aa; cout << ans << endl; return 0; }
replace
6
9
6
9
0
p02754
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cstdlib> #include <iostream> #include <numeric> #include <string> using namespace std; #define REP(i, a, b) for (int i = int(a); i <= int(b); i++) int main() { int n, a, b, k = 0; cin >> n >> a >> b; k = std::min(n % (a + b), a); cout << (n / (a + b)) * a + k; return 0; }
#include <algorithm> #include <bits/stdc++.h> #include <cstdlib> #include <iostream> #include <numeric> #include <string> using namespace std; #define REP(i, a, b) for (int i = int(a); i <= int(b); i++) int main() { unsigned long int n, a, b, k = 0; cin >> n >> a >> b; k = std::min(n % (a + b), a); cout << (n / (a + b)) * a + k; return 0; }
replace
11
12
11
12
0
p02754
C++
Runtime Error
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #include <vector> using namespace std; int syc(long long i, long long Min, long Max) { if (Min <= i && i <= Max) { return 1; } else { exit(1); // return 0; } } int main() { long long n, a, b; // a=blue long long x, y; // x=blue cin >> n >> a >> b; syc(n, 1, 10000000); syc(a + b, 0, 10000000); long long ans = 0; x = n / (a + b); y = n % (a + b); if (y > a) { y = a; } ans = x * a + y; cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #include <vector> using namespace std; int syc(long long i, long long Min, long Max) { if (Min <= i && i <= Max) { return 1; } else { exit(1); // return 0; } } int main() { long long n, a, b; // a=blue long long x, y; // x=blue cin >> n >> a >> b; // syc(n,1,1000000000000000000); // syc(a+b,0,1000000000000000000); if (n < 0 || a < 0 || b < 0) exit(1); long long ans = 0; x = n / (a + b); y = n % (a + b); if (y > a) { y = a; } ans = x * a + y; cout << ans << endl; return 0; }
replace
21
23
21
25
0
p02754
C++
Time Limit Exceeded
#include <iostream> #include <string> using namespace std; int main(void) { long long int N, A, B; cin >> N >> A >> B; long long int AB = A + B; long long int answer = (N / AB) * A; // 先頭から何個チェックする? long long int check_num = N % AB; // 文字列の作成 std::string str; for (long long int i = 0; i < A; i++) { str.push_back('b'); } for (long long int i = 0; i < B; i++) { str.push_back('r'); } // 確認用 // cout << str << endl; for (long long int i = 0; i < check_num; i++) { if (str[i] == 'b') { answer++; } } cout << answer; return 0; }
#include <iostream> #include <string> using namespace std; int main(void) { long long int N, A, B; cin >> N >> A >> B; long long int AB = A + B; long long int answer = (N / AB) * A; // 先頭から何個チェックする? long long int check_num = N % AB; if (A > check_num) { answer += check_num; } else { answer += A; } cout << answer; return 0; }
replace
16
32
16
20
TLE
p02754
C++
Runtime Error
#include <iomanip> #include <iostream> using namespace std; int main() { int n, a, b, ans, zentai, kaisu, amari; cin >> n >> a >> b; zentai = a + b; kaisu = n / zentai; ans = a * kaisu; amari = n - kaisu * zentai; if (amari < a) { ans = ans + amari; } else { ans = ans + a; } cout << ans << endl; }
#include <iomanip> #include <iostream> using namespace std; int main() { long long int n, a, b, ans, zentai, kaisu, amari; cin >> n >> a >> b; zentai = a + b; kaisu = n / zentai; ans = a * kaisu; amari = n - kaisu * zentai; if (amari < a) { ans = ans + amari; } else { ans = ans + a; } cout << ans << endl; }
replace
4
5
4
5
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define whole(f, x, ...) \ ([&](decltype((x)) whole) { \ return (f)(begin(whole), end(whole), ##__VA_ARGS__); \ })(x) #define REP(i, n) for (int i = 0; i < n; ++i) #define REPR(i, n) for (int i = n; i >= 0; --i) #define FOR(i, a, b) for (int i = a; i < b; ++i) #define ALL(x) (x).begin(), (x).end() #define INF 999999999 using namespace std; #define lint long long int main() { lint N, A, B; lint out = 0; cin >> N >> A >> B; ; // string S; // cin >> S; // vector<int> a(N); lint AB = A + B; lint NAB = N / AB; lint NAB2 = N % AB; out = A * NAB; REP(i, NAB2) { if (i < A) ++out; } cout << out; return 0; }
#include <bits/stdc++.h> #define whole(f, x, ...) \ ([&](decltype((x)) whole) { \ return (f)(begin(whole), end(whole), ##__VA_ARGS__); \ })(x) #define REP(i, n) for (int i = 0; i < n; ++i) #define REPR(i, n) for (int i = n; i >= 0; --i) #define FOR(i, a, b) for (int i = a; i < b; ++i) #define ALL(x) (x).begin(), (x).end() #define INF 999999999 using namespace std; #define lint long long int main() { lint N, A, B; lint out = 0; cin >> N >> A >> B; ; // string S; // cin >> S; // vector<int> a(N); lint AB = A + B; lint NAB = N / AB; lint NAB2 = N % AB; out = A * NAB; if (NAB2 > A) { out += A; } else { out += NAB2; } cout << out; return 0; }
replace
26
29
26
30
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << (n / (a + b)) * a + min(n % (a + b), a); }
#include <bits/stdc++.h> using namespace std; int main() { typedef long long ll; ll n, a, b; cin >> n >> a >> b; cout << (n / (a + b)) * a + min(n % (a + b), a); }
replace
4
5
4
6
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; const unsigned int MOD = 1000000007; #define ll long long #define PI 3.1416 string day[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; int main() { // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); ll n, a, b; while (cin >> n >> a >> b) { ll s = 0, cnt = 0; if (a == 0) cout << "0" << endl; else { while (s < n) { ll aa = a, bb = b; while (s < n && aa > 0) { cnt++; aa--; s += 1; } while (s < n && bb > 0) { bb--; s += 1; } } cout << cnt << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; const unsigned int MOD = 1000000007; #define ll long long #define PI 3.1416 string day[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; int main() { // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); ll n, a, b; while (cin >> n >> a >> b) { ll rslt = n / (a + b) * a; ll r = n % (a + b); cout << rslt + min(r, a) << endl; } return 0; }
replace
11
29
11
14
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; namespace FAST_IO { template <typename T> void read(T &a) { a = 0; int f = 1; char c = getchar(); while (!isdigit(c)) { if (c == '-') { f = -1; } c = getchar(); } while (isdigit(c)) { a = a * 10 + c - '0'; c = getchar(); } a = a * f; } template <typename T> void write(T a) { if (a < 0) { a = -a; putchar('-'); } if (a > 9) { write(a / 10); } putchar(a % 10 + '0'); } template <typename T> void writeln(T a) { write(a); puts(""); } } // namespace FAST_IO int n, a, b; int main() { cin >> n >> a >> b; cout << (n / (a + b) * a) + min(a, n % (a + b)); }
#include <bits/stdc++.h> using namespace std; namespace FAST_IO { template <typename T> void read(T &a) { a = 0; int f = 1; char c = getchar(); while (!isdigit(c)) { if (c == '-') { f = -1; } c = getchar(); } while (isdigit(c)) { a = a * 10 + c - '0'; c = getchar(); } a = a * f; } template <typename T> void write(T a) { if (a < 0) { a = -a; putchar('-'); } if (a > 9) { write(a / 10); } putchar(a % 10 + '0'); } template <typename T> void writeln(T a) { write(a); puts(""); } } // namespace FAST_IO long long n, a, b; int main() { cin >> n >> a >> b; cout << (n / (a + b) * a) + min(a, n % (a + b)); }
replace
34
35
34
35
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int INF = 999999999; int main() { int N, A, B; cin >> N >> A >> B; if (N % (A + B) <= A) { cout << A * (N / (A + B)) + N % (A + B) << endl; } else { cout << A * (N / (A + B)) + A << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; const int INF = 999999999; int main() { int64_t N, A, B; cin >> N >> A >> B; if (N % (A + B) <= A) { cout << A * (N / (A + B)) + N % (A + B) << endl; } else { cout << A * (N / (A + B)) + A << endl; } return 0; }
replace
5
6
5
6
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<ll> vll; #define rep(i, n) for (int i = 0; i < (n); ++i) #define Sort(a) sort(a.begin(), a.end()) #define fin(ans) cout << (ans) << endl const int INF = 1 << 30; const ll MOD = 1000000007; int main() { string s, u; int n, a, b, ans; cin >> n >> a >> b; ans = a * (n / (a + b)); if (n % (a + b) >= a) ans += a; else ans += n % (a + b); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<ll> vll; #define rep(i, n) for (int i = 0; i < (n); ++i) #define Sort(a) sort(a.begin(), a.end()) #define fin(ans) cout << (ans) << endl const int INF = 1 << 30; const ll MOD = 1000000007; int main() { ll n, a, b, ans; cin >> n >> a >> b; ans = a * (n / (a + b)); if (n % (a + b) >= a) ans += a; else ans += n % (a + b); cout << ans << endl; }
replace
11
13
11
12
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N, A, B, r; cin >> N >> A >> B; r = N / (A + B) * A; r += min(A, N % (A + B)); cout << r << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N, A, B, r; cin >> N >> A >> B; r = N / (A + B) * A; r += min(A, N % (A + B)); cout << r << endl; }
replace
5
6
5
6
0
p02754
C++
Time Limit Exceeded
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define ll long long int main() { ll N, A, B; cin >> N >> A >> B; ll sum = A + B; ll count = 0; ll ans = 0; while (N > count) { if (N < count + A) { ans += N - count; count = N; } else { ans += A; count += sum; } } cout << ans << endl; }
#include "bits/stdc++.h" using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define ll long long int main() { ll N, A, B; cin >> N >> A >> B; ll sum = A + B; ll ans; ll q = N / (sum); ll r = N % (sum); ll p; if (r >= A) p = A; else p = r; ans = q * A + p; cout << ans << endl; }
replace
9
20
9
18
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int64_t n, a, b, ans = 0; cin >> n >> a >> b; ans += n / (a + b) * a; for (int i = 0; i < n % (a + b); i++) { if (i < a) ans++; } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t n, a, b, ans = 0; cin >> n >> a >> b; ans += n / (a + b) * a; if (n % (a + b) < a) { ans += n % (a + b); } else { ans += a; } cout << ans; return 0; }
replace
8
11
8
12
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < n; i++) int main() { int n, a, b, c; cin >> n >> a >> b; c = n % (a + b); n = n / (a + b); if (c > a) c = a; n = n * a + c; cout << n << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < n; i++) int main() { ll n, a, b, c; cin >> n >> a >> b; c = n % (a + b); n = n / (a + b); if (c > a) c = a; n = n * a + c; cout << n << endl; }
replace
7
8
7
8
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) using namespace std; int main() { fastio; int64_t N, A, B; cin >> N >> A >> B; int64_t total = 0; int64_t blue = 0; while (total < N) { if (total + A >= N) { blue += N - total; break; } total += (A + B); blue += A; } cout << blue << endl; return 0; }
#include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) using namespace std; int main() { fastio; int64_t N, A, B; cin >> N >> A >> B; auto blue = (N / (A + B)) * A; auto total = (N / (A + B)) * (A + B); while (total < N) { if (total + A >= N) { blue += N - total; break; } total += (A + B); blue += A; } cout << blue << endl; return 0; }
replace
8
10
8
11
TLE
p02754
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <cstdint> #include <cstdio> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for (i = s; i < g; i++) using namespace std; using ll = long long; const ll mod = 1000000000 + 7; // 10^9 // bool is_integer(double x){ // return floor(x) == x; // } // vector<int> bitsearch(int n, int bit) { // for (int i = 0; i < n; i++) // { // vector<int> S(n); // if(bit & (1 << i)){ // S.push_back(i); // } // } // }./ int main() { ll N, A, B; cin >> N >> A >> B; ll b_c = 0; while (N - (A + B) > 0) { b_c++; N -= (A + B); } ll ans = 0; if (N > A) { ans += A; } else { ans += N; } ans += b_c * A; cout << ans << endl; }
#include <algorithm> #include <cmath> #include <cstdint> #include <cstdio> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for (i = s; i < g; i++) using namespace std; using ll = long long; const ll mod = 1000000000 + 7; // 10^9 // bool is_integer(double x){ // return floor(x) == x; // } // vector<int> bitsearch(int n, int bit) { // for (int i = 0; i < n; i++) // { // vector<int> S(n); // if(bit & (1 << i)){ // S.push_back(i); // } // } // }./ int main() { ll N, A, B; cin >> N >> A >> B; ll b_c = 0; b_c = N / (A + B); N -= b_c * (A + B); ll ans = 0; if (N > A) { ans += A; } else { ans += N; } ans += b_c * A; cout << ans << endl; }
replace
39
43
39
41
TLE
p02754
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main() { long long int N, A, B; cin >> N >> A >> B; long long int count = 0; while (N != 0 && N >= A + B) { count = count + A; N = N - (A + B); } if (N != 0 && N < A + B && N <= A) { count = count + N; } else if (N != 0 && N < A + B && N > A) { count = count + A; } cout << count << endl; return 0; }
#include <iostream> using namespace std; int main() { long long int N, A, B; cin >> N >> A >> B; long long int count = 0; if (N != 0 && N >= A + B) { count = A * (N / (A + B)); N = N % (A + B); } if (N != 0 && N < A + B && N <= A) { count = count + N; } else if (N != 0 && N < A + B && N > A) { count = count + A; } cout << count << endl; return 0; }
replace
6
9
6
9
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, x, ans; cin >> n >> a >> b; x = n / (a + b); ans = x * a + min(n - x * (a + b), a); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long n, a, b, x, ans; cin >> n >> a >> b; x = n / (a + b); ans = x * a + min(n - x * (a + b), a); cout << ans << endl; return 0; }
replace
4
5
4
5
0
p02754
C++
Runtime Error
#include <iostream> #include <string> // #include<algorithm> // #include<vector> // #include<cmath> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; if (N % (A + B) >= A) { cout << A + N / (A + B) * A; } else { cout << N % (A + B) + N / (A + B) * A; } cout << endl; return 0; }
#include <iostream> #include <string> // #include<algorithm> // #include<vector> // #include<cmath> using namespace std; int main() { long long int N, A, B; cin >> N >> A >> B; if (N % (A + B) >= A) { cout << A + N / (A + B) * A; } else { cout << N % (A + B) + N / (A + B) * A; } cout << endl; return 0; }
replace
9
10
9
10
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a % (b + c) == 0) cout << a / (b + c) * b << endl; else if (a % (b + c) >= b) cout << (a / (b + c) + 1) * b << endl; else cout << a / (b + c) * b + a % (b + c) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; if (a % (b + c) == 0) cout << a / (b + c) * b << endl; else if (a % (b + c) >= b) cout << (a / (b + c) + 1) * b << endl; else cout << a / (b + c) * b + a % (b + c) << endl; }
replace
4
5
4
5
0
p02754
C++
Time Limit Exceeded
#include <iostream> using namespace std; int main(void) { long long n, a, b; cin >> n >> a >> b; long long div; long long remain; div = n / (a + b); remain = n % (a + b); long long blue; blue = div * a; for (long long i(0); i < remain; i++) { if (i < a) { blue++; } } cout << blue << endl; return 0; }
#include <iostream> using namespace std; int main(void) { long long n, a, b; cin >> n >> a >> b; long long div; long long remain; div = n / (a + b); remain = n % (a + b); long long blue; blue = div * a; if (remain >= a) { blue += a; } else { blue += remain; } cout << blue << endl; return 0; }
replace
11
15
11
15
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, a, b; cin >> n >> a >> b; ll count_blue_balls = 0; if (a > 0) { for (ll i = 0; i < n; i++) { if (i < a || i >= b + a) count_blue_balls += 1; } } cout << count_blue_balls << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, a, b; cin >> n >> a >> b; if (a != 0 && 0 < a + b <= pow(10, 18)) cout << a * (n / (a + b)) + min(n % (a + b), a) << endl; else cout << 0 << endl; return 0; }
replace
6
14
6
10
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, x, y, ans; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> n >> x >> y; ans = (n / (x + y)) * x; n %= (x + y); ans += min(x, n); cout << ans; }
#include <bits/stdc++.h> using namespace std; long long n, x, y, ans; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> n >> x >> y; ans = (n / (x + y)) * x; n %= (x + y); ans += min(x, n); cout << ans; }
replace
4
5
4
5
0
p02754
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int solve() { long long n, a, b; cin >> n >> a >> b; long long ans = 0; while (n >= a) { ans += a; n -= a + b; } ans += max(0ll, n); cout << ans << endl; } int main() { solve(); return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <set> #include <string> #include <utility> #include <vector> using namespace std; int solve() { long long n, a, b; cin >> n >> a >> b; long long remain = max(0ll, n - n / (a + b) * (a + b)); long long ans = n / (a + b) * a + (remain >= a ? a : remain); cout << ans << endl; } int main() { solve(); return 0; }
replace
13
19
13
16
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, sum = 0; cin >> n >> a >> b; long long c = n / (a + b), d = n % (a + b); string s; for (int i = 1; i <= d; i++) { if (i <= a) sum++; } sum += a * c; cout << sum; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, sum = 0; cin >> n >> a >> b; long long c = n / (a + b), d = n % (a + b); string s; if (d >= a) sum += a; else sum += d; sum += a * c; cout << sum; return 0; }
replace
9
13
9
13
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(nullptr) #define rep(i, x, y) \ for (decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); \ i += 1 - 2 * ((x) > (y))) #define trav(i, a) for (auto &(i) : (a)) #define all(a) (a).begin(), (a).end() #define sz(a) int((a).size()) #define clr(a, x) memset((a), (x), sizeof(a)) // array (0,-1) #define dbg(x) \ cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << " :(\n"; #define pb push_back #define mp make_pair mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); inline void cpuTime() { cerr << "cpu time : " << double(clock()) / CLOCKS_PER_SEC << "\n"; return; } using ll = long long; using ull = unsigned long long; using F = float; using D = double; using vi = vector<int>; using pii = pair<int, int>; void solve() { ll n, a, b; cin >> n >> a >> b; ll ans = a * (n / (a + b)); ans += min(a, (n % (a + b)) % (a)); cout << ans << "\n"; return; } /* read the question carefully ( what're the exact constraints? ) look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS Check datatypes */ int main() { fast_io; int t = 1; // cin >> t; while (t--) { solve(); } cpuTime(); return 0; }
#include <bits/stdc++.h> using namespace std; #define fast_io \ ios_base::sync_with_stdio(false); \ cin.tie(nullptr) #define rep(i, x, y) \ for (decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); \ i += 1 - 2 * ((x) > (y))) #define trav(i, a) for (auto &(i) : (a)) #define all(a) (a).begin(), (a).end() #define sz(a) int((a).size()) #define clr(a, x) memset((a), (x), sizeof(a)) // array (0,-1) #define dbg(x) \ cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << " :(\n"; #define pb push_back #define mp make_pair mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); inline void cpuTime() { cerr << "cpu time : " << double(clock()) / CLOCKS_PER_SEC << "\n"; return; } using ll = long long; using ull = unsigned long long; using F = float; using D = double; using vi = vector<int>; using pii = pair<int, int>; void solve() { ll n, a, b; cin >> n >> a >> b; ll ans = a * (n / (a + b)); ans += min(a, n % (a + b)); cout << ans << "\n"; return; } /* read the question carefully ( what're the exact constraints? ) look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS Check datatypes */ int main() { fast_io; int t = 1; // cin >> t; while (t--) { solve(); } cpuTime(); return 0; }
replace
35
36
35
36
0
cpu time : 0.027327
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << ((n / (a + b)) * a) + min(n % (a + b), a); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << ((n / (a + b)) * a) + min(n % (a + b), a); return 0; }
replace
4
5
4
5
0
p02754
C++
Runtime Error
#include <iostream> using namespace std; int main(void) { int n, a, b, c, d, out; cin >> n >> a >> b; d = n % (a + b); c = (n - d) / (a + b); if (d < a) { out = c * a + d; } else { out = c * a + a; } cout << out; }
#include <iostream> using namespace std; int main(void) { long int n, a, b, c, d, out; cin >> n >> a >> b; d = n % (a + b); c = (n - d) / (a + b); if (d < a) { out = c * a + d; } else { out = c * a + a; } cout << out; }
replace
4
5
4
5
0
p02754
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; using ll = long long; int main() { int n, a, b, cnt = 0, mod = 0; cin >> n >> a >> b; cnt = n / (a + b); mod = n % (a + b); if (mod >= a) mod = a; cout << a * cnt + mod << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; using ll = long long; int main() { ll n, a, b, cnt = 0, mod = 0; cin >> n >> a >> b; cnt = n / (a + b); mod = n % (a + b); if (mod >= a) mod = a; cout << a * cnt + mod << endl; return 0; }
replace
10
11
10
11
0
p02754
C++
Runtime Error
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int N, A, B, n; cin >> N >> A >> B; n = N / (A + B); if (N % (A + B) <= A) { cout << n * A + N % (A + B); } else { cout << n * A + A; } return 0; }
#include <iostream> #include <string> #include <vector> using namespace std; int main() { long long N, A, B, n; cin >> N; cin >> A; cin >> B; n = N / (A + B); if (N % (A + B) <= A) { cout << n * A + N % (A + B); } else { cout << n * A + A; } return 0; }
replace
6
8
6
10
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long #define MAX 200005 using namespace std; ll a[MAX]; int main() { // ios_base::sync_with_stdio(false); // cin.tie(0); ll n, a, b; cin >> n >> a >> b; ll ans = 0; while (n > 0) { if (n >= a + b) { ans += a; n = n - a - b; } else if (n >= a) { ans += a; n = 0; } else { ans += n; n = 0; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define ll long long #define MAX 200005 using namespace std; ll a[MAX]; int main() { // ios_base::sync_with_stdio(false); // cin.tie(0); ll n, a, b; cin >> n >> a >> b; ll ans = 0; ans = n / (a + b); ans *= a; n %= (a + b); if (n >= a) { ans += a; } else { ans += n; } cout << ans << endl; return 0; }
replace
14
25
14
21
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, A, B; cin >> N, A, B; ll ans = N / (A + B) * A; N %= A + B; ans += min(A, N); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, A, B; cin >> N >> A >> B; ll ans = A * (N / (A + B)); N %= A + B; ans += min(A, N); cout << ans << endl; }
replace
6
8
6
8
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, r, b; cin >> n >> b >> r; cout << n / (r + b) * b + min(n % (r + b), b) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long long n, r, b; cin >> n >> b >> r; cout << n / (r + b) * b + min(n % (r + b), b) << endl; }
replace
6
7
6
7
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define ld long double #define float long double #define ll long long #define int long long #define vl vector<ll> #define mp make_pair #define pb push_back #define sd second #define ft first #define all(x) x.begin(), x.end() #define alr(x) x.rbegin(), x.rend() #define endl '\n' #define cnl cout << endl; #define pi 3.141592653589793238 #define ms(x, v) ((x), v, sizeof((x))) #define MAXN 100009 #define CASET \ int ___T; \ scanf("%lld", &___T); \ for (int cs = 1; cs <= ___T; cs++) template <class T> bool umin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> bool umax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } const int N = 200 * 1000 + 9; const int inf = 1e18; const int mod = 1e9 + 7; int i, j, k; void solve() { int n, b, r; cin >> n >> b >> r; int sum = 0; int bl = 0; i = 1; while (sum < n) { if (i % 2) sum = sum + b, bl = bl + b; else sum = sum + r; i++; } if (sum > n) { if (i % 2 == 0) { int x = sum - n; bl = bl - x; } } cout << bl << endl; return; } signed main() { // CASET solve(); return 0; }
#include <bits/stdc++.h> using namespace std; #define ld long double #define float long double #define ll long long #define int long long #define vl vector<ll> #define mp make_pair #define pb push_back #define sd second #define ft first #define all(x) x.begin(), x.end() #define alr(x) x.rbegin(), x.rend() #define endl '\n' #define cnl cout << endl; #define pi 3.141592653589793238 #define ms(x, v) ((x), v, sizeof((x))) #define MAXN 100009 #define CASET \ int ___T; \ scanf("%lld", &___T); \ for (int cs = 1; cs <= ___T; cs++) template <class T> bool umin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> bool umax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } const int N = 200 * 1000 + 9; const int inf = 1e18; const int mod = 1e9 + 7; int i, j, k; void solve() { int n, b, r; cin >> n >> b >> r; int sum = 0; int bl = 0; i = 1; int no = (n / (b + r)); int rem = n % (b + r); cout << (no * b + min(rem, b)) << endl; return; } signed main() { // CASET solve(); return 0; }
replace
46
60
46
49
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n; cin >> n >> a >> b; long long cnt_b = 0, cnt_r = 0, cnt = 0; for (long long i = 0; i < pow(10, 100); i++) { for (int j = 0; j < a; j++) { cnt_b++; cnt++; if (cnt == n) { break; } } if (cnt == n) { break; } for (int k = 0; k < b; k++) { cnt_r++; cnt++; if (cnt == n) { break; } } if (cnt == n) { break; } } cout << cnt_b << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, n; cin >> n >> a >> b; long long cnt_b; long long set = n / (a + b); long long set_ext = n % (a + b); cnt_b = set * a; if (set_ext > a) { cnt_b += a; } else { cnt_b += set_ext; } cout << cnt_b << endl; }
replace
6
28
6
14
TLE
p02754
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; void solve() { int64_t n, a, b; cin >> n >> a >> b; if (a == 0) { cout << 0; return; } int64_t c = a + b; int64_t x = 1; while (true) { if (x * c == n) { cout << x * a; return; } else if (x * c > n) { x--; break; } else { x++; } } int64_t result = x * a; int64_t rem = n - x * c; if (a <= rem) result += a; if (a > rem) result += rem; cout << result; } int main() { solve(); return 0; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; void solve() { int64_t n, a, b; cin >> n >> a >> b; if (a == 0) { cout << 0; return; } int64_t c = a + b; int64_t x = n / c; if (x * c == n) { cout << x * a; return; } int64_t result = x * a; int64_t rem = n - x * c; if (a <= rem) result += a; if (a > rem) result += rem; cout << result; } int main() { solve(); return 0; }
replace
21
32
21
25
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << n / (a + b) * a + min(n % (a + b), a); }
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << n / (a + b) * a + min(n % (a + b), a); }
replace
4
5
4
5
0
p02754
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <functional> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n, a, b, x, y; cin >> n >> a >> b; x = n / (a + b); y = n - x * (a + b); if (y >= a) y = a; else y = y; cout << x * a + y << endl; return 0; }
#include <algorithm> #include <bits/stdc++.h> #include <functional> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { long long n, a, b, x, y; cin >> n >> a >> b; x = n / (a + b); y = n - x * (a + b); if (y >= a) y = a; else y = y; cout << x * a + y << endl; return 0; }
replace
7
8
7
8
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; cout << (N / (A + B) * A + min(N % (A + B), A)) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t N, A, B; cin >> N >> A >> B; cout << (N / (A + B) * A + min(N % (A + B), A)) << endl; }
replace
4
5
4
5
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < (N); i++) #define repo(i, N) for (int i = 1; i < (N); i++) #define pb push_back #define mp make_pair #define ll long long #define fi first #define se second #define all(x) (x).begin(), (x).end() // #define num 1000000007 #define pi acos(-1.0) // cout << fixed << setprecision (20); 小数点以下20桁まで // intの最大値2147483647 ≒ 2×10^9 // long longの最大値9223372036854775807 ≒ 9×10^18 //'大文字'+=32; で小文字に // string s = to_string(int数); // int n = stoi(string文字列); int main() { int n, a, b; cin >> n >> a >> b; cout << (n / (a + b)) * a + min(a, n % (a + b)); }
#include <bits/stdc++.h> using namespace std; #define rep(i, N) for (int i = 0; i < (N); i++) #define repo(i, N) for (int i = 1; i < (N); i++) #define pb push_back #define mp make_pair #define ll long long #define fi first #define se second #define all(x) (x).begin(), (x).end() // #define num 1000000007 #define pi acos(-1.0) // cout << fixed << setprecision (20); 小数点以下20桁まで // intの最大値2147483647 ≒ 2×10^9 // long longの最大値9223372036854775807 ≒ 9×10^18 //'大文字'+=32; で小文字に // string s = to_string(int数); // int n = stoi(string文字列); int main() { long long n, a, b; cin >> n >> a >> b; cout << (n / (a + b)) * a + min(a, n % (a + b)); }
replace
20
21
20
21
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, A, B, count, s, t; cin >> N >> A >> B; s = N / (A + B); t = N - (A + B) * s; if (t < A) { count = s * A + t; } else { count = s * A + A; } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t N, A, B, count, s, t; cin >> N >> A >> B; s = N / (A + B); t = N - (A + B) * s; if (t < A) { count = s * A + t; } else { count = s * A + A; } cout << count << endl; }
replace
4
5
4
5
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; // container util #define SORT(c) sort((c).begin(), (c).end()) // repetition #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) const int INF = 1e9; int main(void) { ll N, A, B; cin >> N >> A >> B; ll ans = 0; ll sum = 0; while (sum < N) { if (sum + A <= N) { sum += A; ans += A; } else if (sum + A > N) { ans += N - sum; break; } if (sum + B <= N) { sum += B; } else if (sum + B > N) { break; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; // container util #define SORT(c) sort((c).begin(), (c).end()) // repetition #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) const int INF = 1e9; int main(void) { ll N, A, B; cin >> N >> A >> B; ll ans = 0; ans = (N / (A + B)) * A + min(A, N % (A + B)); cout << ans << endl; return 0; }
replace
20
35
20
21
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define sort(s) sort(s.begin(), s.end()) #define reverse(s) reverse(s.begin(), s.end()) #define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++) const ll mod = 1e9 + 7; // 最大公約数 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } // 最小公倍数 ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } // 素数判定 bool isPrime(ll x) { ll i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1; } // 桁和 int digsum(ll n) { int res = 0; while (n > 0) { res += n % 10; n /= 10; } return res; } // 桁数 int dignum(ll n) { int res = 0; while (n > 0) { res++; n /= 10; } return res; } // 文字列中の特定の文字カウント ll stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); } // 階乗 ll ka(ll i) { ll res = 1; while (i > 0) { res = res * i; i--; } return res; } // ncr ll ncr(ll x, ll y) { ll a = x; ll b = 1; if (y > (x / 2)) { y = x - y; } for (ll i = 1; i < y; i++) { a *= x - i; b *= i + 1; } return a / b; } // フィボナッチ数列 -92 ll f(ll x) { ll dp[x + 1]; dp[1] = 1; dp[2] = 1; for (ll i = 3; i <= x; i++) { dp[i] = dp[i - 1] + dp[i - 2]; } return dp[x]; } int main() { ll n; ll a, b; cin >> n >> a >> b; ll x = 0; ll b_count = 0; while (n > x) { x += a; b_count += a; if (x >= n) { b_count = b_count - (x - n); break; } x += b; } cout << b_count << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define sort(s) sort(s.begin(), s.end()) #define reverse(s) reverse(s.begin(), s.end()) #define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++) const ll mod = 1e9 + 7; // 最大公約数 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } // 最小公倍数 ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } // 素数判定 bool isPrime(ll x) { ll i; if (x < 2) return 0; else if (x == 2) return 1; if (x % 2 == 0) return 0; for (i = 3; i * i <= x; i += 2) if (x % i == 0) return 0; return 1; } // 桁和 int digsum(ll n) { int res = 0; while (n > 0) { res += n % 10; n /= 10; } return res; } // 桁数 int dignum(ll n) { int res = 0; while (n > 0) { res++; n /= 10; } return res; } // 文字列中の特定の文字カウント ll stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); } // 階乗 ll ka(ll i) { ll res = 1; while (i > 0) { res = res * i; i--; } return res; } // ncr ll ncr(ll x, ll y) { ll a = x; ll b = 1; if (y > (x / 2)) { y = x - y; } for (ll i = 1; i < y; i++) { a *= x - i; b *= i + 1; } return a / b; } // フィボナッチ数列 -92 ll f(ll x) { ll dp[x + 1]; dp[1] = 1; dp[2] = 1; for (ll i = 3; i <= x; i++) { dp[i] = dp[i - 1] + dp[i - 2]; } return dp[x]; } int main() { ll n; ll a, b; cin >> n >> a >> b; ll x = n / (a + b); ll ans = x * a + min(a, n % (a + b)); cout << ans << endl; }
replace
97
109
97
100
TLE
p02754
C++
Time Limit Exceeded
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <stdio.h> #include <vector> #define REP(i, n, N) for (ll i = (n); i < (N); i++) // #define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--) #define p(s) cout << (s) << endl #define p2(a, b) cout << (a) << " " << (b) << endl using namespace std; typedef long long ll; const long long MOD = 1e9 + 7; int main() { ll n, a, b; cin >> n >> a >> b; ll count = 0; ll ans = 0; while (count <= n) { ans += a; count += a + b; } if (count - n > b) { ans -= count - n - b; } p(ans); return 0; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <stdio.h> #include <vector> #define REP(i, n, N) for (ll i = (n); i < (N); i++) // #define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--) #define p(s) cout << (s) << endl #define p2(a, b) cout << (a) << " " << (b) << endl using namespace std; typedef long long ll; const long long MOD = 1e9 + 7; int main() { ll n, a, b; cin >> n >> a >> b; ll count = 0; ll ans = 0; // while(count <= n){ // ans += a; // count += a + b; // } ll time; time = (n / (a + b)) + 1; ans = a * time; count = (a + b) * time; if (count - n > b) { ans -= count - n - b; } p(ans); return 0; }
replace
27
31
27
36
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << n / (a + b) * a + min(n % (a + b), a) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << n / (a + b) * a + min(n % (a + b), a) << endl; return 0; }
replace
5
6
5
6
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << (n / (a + b)) * a + min((n % (a + b)), a) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int n, a, b; cin >> n >> a >> b; cout << (n / (a + b)) * a + min((n % (a + b)), a) << endl; return 0; }
replace
4
5
4
5
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, A, B; cin >> N >> A >> B; cout << A * (N / (A + B)) + min(N % (A + B), A) << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; template <class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll N, A, B; cin >> N >> A >> B; cout << A * (N / (A + B)) + min(N % (A + B), A) << endl; }
replace
22
23
22
23
0
p02754
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; cout << N / (A + B) * A + min(A, (N % (A + B))) << endl; }
#include <algorithm> #include <iostream> using namespace std; int main() { long long N, A, B; cin >> N >> A >> B; cout << N / (A + B) * A + min(A, (N % (A + B))) << endl; }
replace
5
6
5
6
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> #include <iostream> #include <math.h> using namespace std; int main() { long long n; cin >> n; long long a, b; cin >> a >> b; long long hoge = 0; long long ans = 0; while (true) { hoge += a; ans += a; if (hoge >= n) { if (hoge >= n) cout << ans - (hoge - n) << endl; else cout << ans << endl; break; } hoge += b; if (hoge >= n) { cout << ans << endl; break; } } return 0; }
#include <bits/stdc++.h> #include <iostream> #include <math.h> using namespace std; int main() { long long n; cin >> n; long long a, b; cin >> a >> b; long long hoge = a + b; long long fuga = n / hoge * a; n %= hoge; if (n <= a) cout << fuga + n << endl; else cout << fuga + a << endl; return 0; }
replace
11
30
11
18
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << (n / (a + b) * a + min(a, n % (a + b))); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, t, ans = 0; cin >> n >> a >> b; cout << (n / (a + b) * a + min(a, n % (a + b))); return 0; }
replace
3
4
3
4
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int n, c, i, j, k, h, w, a, b; int main() { cin >> n >> a >> b; i = n / (a + b); j = n % (a + b); cout << i * a + min(a, j); }
#include <bits/stdc++.h> using namespace std; long long n, c, i, j, k, h, w, a, b; int main() { cin >> n >> a >> b; i = n / (a + b); j = n % (a + b); cout << i * a + min(a, j); }
replace
2
3
2
3
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << endl #define COUTF(x) cout << setprecision(15) << (x) << endl #define ENDL cout << endl #define DF(x) x.erase(x.begin()) // 先頭文字削除 #define ALL(x) x.begin(), x.end() #define SORT(x) sort(ALL(x)) #define REVERSE(x) reverse(ALL(x)) #ifdef _DEBUG #define debug(x) cout << "[debug] " << #x << ": " << x << endl #else #define debug(x) #endif using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; constexpr int INF = 0x3f3f3f3f; constexpr ll INFL = 0x3f3f3f3f3f3f3f3f; constexpr double PI = 3.141592653589793238462643383279; ll getDigit(ll x) { return x == 0 ? 1 : log10(x) + 1; } signed main() { ll N, A, B; cin >> N >> A >> B; ll ans = N / (A + B) * A + N % (A + B) % A; COUT(ans); return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << endl #define COUTF(x) cout << setprecision(15) << (x) << endl #define ENDL cout << endl #define DF(x) x.erase(x.begin()) // 先頭文字削除 #define ALL(x) x.begin(), x.end() #define SORT(x) sort(ALL(x)) #define REVERSE(x) reverse(ALL(x)) #ifdef _DEBUG #define debug(x) cout << "[debug] " << #x << ": " << x << endl #else #define debug(x) #endif using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; constexpr int INF = 0x3f3f3f3f; constexpr ll INFL = 0x3f3f3f3f3f3f3f3f; constexpr double PI = 3.141592653589793238462643383279; ll getDigit(ll x) { return x == 0 ? 1 : log10(x) + 1; } signed main() { ll N, A, B; cin >> N >> A >> B; ll amari = N % (A + B); ll ans = N / (A + B) * A; debug(ans); if (amari > A) { ans += A; } else { ans += amari; } COUT(ans); return 0; }
replace
29
30
29
37
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, N; cin >> N >> A >> B; long long ikkai = A + B; int s = 0; for (int i = 0; i < N; i++) if (N - ikkai < 0) { break; } else { N = N - ikkai; s++; } if (A == 0) cout << 0; else if (N >= A) cout << s * A + A; else cout << s * A + N; }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, N; cin >> N >> A >> B; auto ikkai = A + B; auto n = N / ikkai; // 何回割れるか試す auto m = N % ikkai; // 最後に割ったときのあまり auto a = min(A, m); cout << A * n + a; }
replace
5
20
5
10
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int li; typedef long double ld; typedef vector<li> vi; typedef pair<li, li> pi; #define PB push_back #define MP make_pair #define F first #define S second #define B begin() #define E end() #define f(i, l, r) for (li i = l; i <= r; ++i) #define fr(i, l, r) for (li i = l; i >= r; --i) #define u_map unordered_map #define endl "\n" li fastpow(li base, li exp, li M) { li res = 1; while (exp > 0) { if (exp & 1) res = (res * base) % M; base = (base * base) % M; exp >>= 1; } return res; } vi par, sz, vis, dis; vector<vi> graph; vector<vector<pair<li, li>>> wgraph; void init(li n) { par.resize(n); sz.resize(n); wgraph.resize(n); dis.resize(n); vis.resize(n); graph.resize(n); f(i, 0, n - 1) { par[i] = i; sz[i] = 1; dis[i] = 1e18; } } li root(li a) { while (a != par[a]) { par[a] = par[par[a]]; a = par[a]; } return a; } void unio(li a, li b) { li r_a = root(a); li r_b = root(b); if (par[r_a] != r_b) { if (sz[r_a] < sz[r_b]) { par[r_a] = par[r_b]; sz[r_b] += sz[r_a]; sz[r_a] = 0; } else { par[r_b] = par[r_a]; sz[r_a] += sz[r_b]; sz[r_b] = 0; } } } int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); li n, a, b; cin >> n >> a >> b; li tp1, tp2; tp1 = n / (a + b); tp2 = min(n % (a + b), a); cout << tp1 * a + tp2; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int li; typedef long double ld; typedef vector<li> vi; typedef pair<li, li> pi; #define PB push_back #define MP make_pair #define F first #define S second #define B begin() #define E end() #define f(i, l, r) for (li i = l; i <= r; ++i) #define fr(i, l, r) for (li i = l; i >= r; --i) #define u_map unordered_map #define endl "\n" li fastpow(li base, li exp, li M) { li res = 1; while (exp > 0) { if (exp & 1) res = (res * base) % M; base = (base * base) % M; exp >>= 1; } return res; } vi par, sz, vis, dis; vector<vi> graph; vector<vector<pair<li, li>>> wgraph; void init(li n) { par.resize(n); sz.resize(n); wgraph.resize(n); dis.resize(n); vis.resize(n); graph.resize(n); f(i, 0, n - 1) { par[i] = i; sz[i] = 1; dis[i] = 1e18; } } li root(li a) { while (a != par[a]) { par[a] = par[par[a]]; a = par[a]; } return a; } void unio(li a, li b) { li r_a = root(a); li r_b = root(b); if (par[r_a] != r_b) { if (sz[r_a] < sz[r_b]) { par[r_a] = par[r_b]; sz[r_b] += sz[r_a]; sz[r_a] = 0; } else { par[r_b] = par[r_a]; sz[r_a] += sz[r_b]; sz[r_b] = 0; } } } int main() { // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); // #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); li n, a, b; cin >> n >> a >> b; li tp1, tp2; tp1 = n / (a + b); tp2 = min(n % (a + b), a); cout << tp1 * a + tp2; return 0; }
replace
77
81
77
81
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { long long int N, b, r, S = 0, sum = 0; cin >> N >> b >> r; while (sum <= N - (b + r)) { S += b; sum += b + r; } if (N - sum < b) { S += N - sum; } else { S += b; } cout << S << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long int N, b, r, S = 0, sum = 0; cin >> N >> b >> r; S = N / (b + r) * b; if (N - (N / (b + r) * (b + r)) < b) { S += N - (N / (b + r) * (b + r)); } else { S += b; } cout << S << endl; }
replace
5
11
5
8
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ll n, a, b; cin >> n >> a >> b; ll res = 0; ll sum = 0; ll cnt = 0; while (true) { if (sum > n) { break; } if (cnt % 2 == 0) sum += a; if (cnt % 2 != 0) sum += b; cnt++; } if (cnt % 2 == 0) { res = a * (cnt / 2); } else if (cnt % 2 != 0) { res = a * ((cnt - 1) / 2) + (n - (a + b) * (cnt - 1) / 2); } cout << res << endl; return 0; }
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ll n, a, b; cin >> n >> a >> b; ll res = 0; ll rem = 0; res = n / (a + b) * a; rem = n % (a + b); res += min(rem, a); cout << res << endl; return 0; }
replace
9
26
9
14
TLE
p02754
C++
Time Limit Exceeded
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long INF = 1LL << 60; typedef pair<ll, ll> pairs; vector<pairs> p; bool pairCompare(const pair<double, ll> &firstElof, const pair<double, ll> &secondElof) { return firstElof.first < secondElof.first; } #define MAX_N 1000100 bool x[MAX_N]; ll num[MAX_N]; ll fibl[MAX_N] = {0}; ll fib(ll a) { if (fibl[a] != 0) return fibl[a]; if (a == 0) { return 0; } else if (a == 1) { return 1; } return fibl[a] = fib(a - 1) + fib(a - 2); } ll eratosthenes(ll n) { int p = 0; for (ll i = 0; i <= n; ++i) x[i] = true; x[0] = x[1] = false; for (int i = 2; i <= n; ++i) { if (x[i]) { p++; for (int j = 2 * i; j <= n; j += i) x[j] = false; } num[i] = p; } return p; } ll gcd(ll a, ll b) { if (a % b == 0) return (b); else return (gcd(b, a % b)); } ll keta(ll N) { int tmp{}; while (N > 0) { tmp += (N % 10); N /= 10; } N = tmp; return N; } int main() { ll n, a, b, ans = 0; cin >> n >> a >> b; while (n > 0) { n -= a; if (n > 0) { ans += a; } else { ans += a; ans += n; } n -= b; } cout << ans << endl; return 0; }
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <math.h> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long int ll; typedef long double ld; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long INF = 1LL << 60; typedef pair<ll, ll> pairs; vector<pairs> p; bool pairCompare(const pair<double, ll> &firstElof, const pair<double, ll> &secondElof) { return firstElof.first < secondElof.first; } #define MAX_N 1000100 bool x[MAX_N]; ll num[MAX_N]; ll fibl[MAX_N] = {0}; ll fib(ll a) { if (fibl[a] != 0) return fibl[a]; if (a == 0) { return 0; } else if (a == 1) { return 1; } return fibl[a] = fib(a - 1) + fib(a - 2); } ll eratosthenes(ll n) { int p = 0; for (ll i = 0; i <= n; ++i) x[i] = true; x[0] = x[1] = false; for (int i = 2; i <= n; ++i) { if (x[i]) { p++; for (int j = 2 * i; j <= n; j += i) x[j] = false; } num[i] = p; } return p; } ll gcd(ll a, ll b) { if (a % b == 0) return (b); else return (gcd(b, a % b)); } ll keta(ll N) { int tmp{}; while (N > 0) { tmp += (N % 10); N /= 10; } N = tmp; return N; } int main() { ll n, a, b, ans = 0; cin >> n >> a >> b; ll c = a + b; ans += (n / c) * a; n = n % c; n -= a; if (n > 0) { ans += a; } else { ans += a; ans += n; } cout << ans << endl; return 0; }
replace
90
99
90
100
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; n > i; ++i) using namespace std; using ll = int64_t; using pii = pair<int, int>; using vi = vector<int>; using vis = vector<string>; using vvi = vector<vi>; // pとqの最大公約数 int gcd(int p, int q) { if (p % q == 0) return q; return gcd(q, p % q); } int main() { int n, a, b; cin >> n >> a >> b; cout << (n / (a + b) * a) + min(a, n % (a + b)) << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; n > i; ++i) using namespace std; using ll = int64_t; using pii = pair<int, int>; using vi = vector<int>; using vis = vector<string>; using vvi = vector<vi>; // pとqの最大公約数 int gcd(int p, int q) { if (p % q == 0) return q; return gcd(q, p % q); } int main() { ll n, a, b; cin >> n >> a >> b; cout << (n / (a + b) * a) + min(a, n % (a + b)) << endl; }
replace
15
16
15
16
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N, A, B, result, res; cin >> N >> A >> B; result = N / (A + B) * A; res = min(N % (A + B), A); result = result + res; cout << result << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long N, A, B, result, res; cin >> N >> A >> B; result = N / (A + B) * A; res = min(N % (A + B), A); result = result + res; cout << result << endl; }
replace
4
5
4
5
0
p02754
C++
Time Limit Exceeded
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; using Graph = vector<vector<int>>; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; #define INF 100000000 #define MAX 200001 #define MOD 1000000007 ll fac[MAX], finv[MAX], inv[MAX]; const int MX = 1000005; int main() { ll n, a, b; cin >> n >> a >> b; ll count = 0; ll ans = 0; int flag = 1; while (true) { if (flag) { if (count + a > n) { ans += n - count; break; } else { count += a; ans += a; } flag = 0; } else { count += b; flag = 1; if (count > n) break; } } cout << ans << endl; }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; using Graph = vector<vector<int>>; int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; #define INF 100000000 #define MAX 200001 #define MOD 1000000007 ll fac[MAX], finv[MAX], inv[MAX]; const int MX = 1000005; int main() { ll n, a, b; cin >> n >> a >> b; ll sum = a + b; ll ans = (n / sum) * a; ans += min(n - (n / sum) * sum, a); cout << ans << endl; }
replace
26
46
26
29
TLE
p02754
C++
Runtime Error
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> #define fir first #define sec second #define sz(s) (s).size() #define pb push_back #define get(n) scanf("%d", &n); #define gets(s) \ string s; \ cin >> (s); #define prfi(n) printf("%d", &n); #define prfd(n) printf("%lf", &n); #define All(s) (s).begin(), (s).end() #define rep(i, j) for (int(i) = 0; (i) < (j); (i)++) #define For(i, j, k) for (int(i) = (j); (i) < (k); (i)++) #define drep(i, j) for (int(i) = (j); (i) >= 0; (i)--) #define Ford(i, j, k) for (int(i) = (j); i >= (k); i--) #define fore(c, v) for (auto(c) : (v)) #define lp for (int i = 0; i < n; i++) #define mem(a, b) memset(a, b, sizeof(a)); #define dump(x) std::cout << #x << " = " << (x) << std::endl; #define debug(x) \ cout << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; using ull = unsigned long long int; using ll = long long; using ld = long double; using pii = std::pair<int, int>; using pll = std::pair<ll, ll>; using vi = std::vector<int>; using vvi = std::vector<vi>; using vll = std::vector<ll>; using vvll = std::vector<vll>; using vd = std::vector<double>; using vvd = std::vector<vd>; using qi = std::queue<int>; using vpii = std::vector<std::pair<int, int>>; using vpll = std::vector<pll>; using namespace std; const int Mod = (1e9) + 7; const int INF = 1e9 + 19; const ll INFL = 1e18 + 19; const int dx[] = {-1, 0, 0, 1}; const int dy[] = {0, -1, 1, 0}; const int dx2[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1}; const int dy2[] = {1, 0, -1, 1, 0, -1, 1, 0, -1}; //_____________________________________Templates_________________________________________// template <class T1, class T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; } template <class T1, class T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; } template <class T> inline void pri(T a) { cout << a << endl; } template <class Z> using vec = vector<Z>; template <class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>; // mainly use for dynamic prog template <class T1, class T2> void update(T1 &a, T2 b) { a += b; if (a > Mod) a %= Mod; } inline void IN(void) { return; } template <typename First, typename... Rest> void IN(First &first, Rest &...rest) { cin >> first; IN(rest...); return; } inline void OUT(void) { cout << "\n"; return; } template <typename First, typename... Rest> void OUT(First first, Rest... rest) { cout << first << " "; OUT(rest...); return; } bool pairsort(pll pl, pll pr) { if (pl.first == pr.first) return pl.second > pr.second; return pl.first < pr.first; } int cntbit(ll a, int n, int j) { int res = 0; For(i, j, n) { if (a >> i & 1) { res++; } } return res; } vector<int> make_bit(int a) { vector<int> res; for (int i = 31; i >= 0; i--) if (a & (1 << i)) res.pb(i); return res; } bool stdbit(int a, int b) { return a & (1 << b); } int GCD(int a, int b) { if (b > a) return GCD(b, a); if (a % b == 0) return b; else return GCD(b, a % b); } int LCM(int a, int b) { return a * b / GCD(a, b); } int roundup(int a, int b) { if (a % b == 0) return a / b; else return (a + b) / b; } int rounddown(int a, int b) { if (a % b == 0) return a / b; else { return a / b; } } ll pow(ll a, ll n) { ll res = 1; while (n > 0) { if (n & 1) res *= a; a *= a; n = n >> 1; } return res; } ll GetDiviserCount(ll N) // 約数の個数 { ll res = 1; For(i, 2, sqrt(N) + 1) { ll cnt = 0; while (N % i == 0) { cnt++; N /= i; } res *= (cnt + 1); if (N == 1) break; } if (N != 1) res *= 2; return res; } vll GetDivisor(ll N) // 約数列挙 { vll res; for (ll i = 1; i * i <= N; i++) { if (N % i == 0) { res.pb(i); if (i * i != N) res.pb(N / i); } } sort(All(res)); return res; } template <class Z> struct Matrix { using mat = Matrix<Z>; vector<vector<Z>> m_dat; int m_h; int m_w; Matrix(int h, int w, Z x = 0) : m_h(h), m_w(w), m_dat(h, vector<Z>(w, x)) {} Matrix(vector<vector<Z>> &v) { m_dat = v; m_h = v.size(); m_w = v[0].size(); } vector<Z> &operator[](int idx) { return m_dat[idx]; } mat Multiple(mat &a) { mat C(m_h, a.m_w); for (int i = 0; i < m_h; i++) { for (int j = 0; j < a.m_w; j++) { for (int k = 0; k < m_w; k++) { C[i][j] += m_dat[i][k] * a[k][j]; } } } return C; } mat Pow(ll x) { mat B(m_h, m_w); for (int i = 0; i < m_h; i++) { B[i][i] = 1; } mat A = *this; while (x > 0) { if (x & 1) B = B.Multiple(A); A = A.Multiple(A); x = x >> 1; } return B; } friend ostream &operator<<(ostream &os, const mat &A); }; template <class Z> ostream &operator<<(ostream &os, Matrix<Z> &A) { for (int i = 0; i < A.m_h; i++) { for (int j = 0; j < A.m_w; j++) { os << A.m_dat[i][j] << " "; } os << endl; } return os; } template <class Z> using mat = Matrix<Z>; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % Mod + Mod) % Mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= Mod) x -= Mod; return *this; } mint &operator-=(const mint a) { if ((x += Mod - a.x) >= Mod) x -= Mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= Mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(Mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } friend ostream &operator<<(ostream &os, const mint &a); }; ostream &operator<<(ostream &os, const mint &a) { os << a.x; return os; } struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { assert(n < Mod); fact[0] = 1; for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; } }; //_____________________ following sorce code_________________________// const int max_n = 3 * (1e5) + 1; const int max_m = 83 * (1e5) + 1; int n, m, k; ll N; int h, w; vvi tree; string S; int a, b, c; vi v; int ans; signed main() { cin.tie(0); ios::sync_with_stdio(false); IN(n, a, b); k = n / (a + b); // dump(k); ans = k * a; // dump(ans); m = n - (k * (a + b)); if (m > a) ans += a; else ans += m; // dump(ans); cout << ans << endl; // for(auto c : ans){cout << c << endl;} // cout << fixed << setprecision(15) << ans << endl; return 0; }
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> #define fir first #define sec second #define sz(s) (s).size() #define pb push_back #define get(n) scanf("%d", &n); #define gets(s) \ string s; \ cin >> (s); #define prfi(n) printf("%d", &n); #define prfd(n) printf("%lf", &n); #define All(s) (s).begin(), (s).end() #define rep(i, j) for (int(i) = 0; (i) < (j); (i)++) #define For(i, j, k) for (int(i) = (j); (i) < (k); (i)++) #define drep(i, j) for (int(i) = (j); (i) >= 0; (i)--) #define Ford(i, j, k) for (int(i) = (j); i >= (k); i--) #define fore(c, v) for (auto(c) : (v)) #define lp for (int i = 0; i < n; i++) #define mem(a, b) memset(a, b, sizeof(a)); #define dump(x) std::cout << #x << " = " << (x) << std::endl; #define debug(x) \ cout << #x << " = " << (x) << " (L" << __LINE__ << ")" \ << " " << __FILE__ << endl; using ull = unsigned long long int; using ll = long long; using ld = long double; using pii = std::pair<int, int>; using pll = std::pair<ll, ll>; using vi = std::vector<int>; using vvi = std::vector<vi>; using vll = std::vector<ll>; using vvll = std::vector<vll>; using vd = std::vector<double>; using vvd = std::vector<vd>; using qi = std::queue<int>; using vpii = std::vector<std::pair<int, int>>; using vpll = std::vector<pll>; using namespace std; const int Mod = (1e9) + 7; const int INF = 1e9 + 19; const ll INFL = 1e18 + 19; const int dx[] = {-1, 0, 0, 1}; const int dy[] = {0, -1, 1, 0}; const int dx2[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1}; const int dy2[] = {1, 0, -1, 1, 0, -1, 1, 0, -1}; //_____________________________________Templates_________________________________________// template <class T1, class T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; } template <class T1, class T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; } template <class T> inline void pri(T a) { cout << a << endl; } template <class Z> using vec = vector<Z>; template <class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>; // mainly use for dynamic prog template <class T1, class T2> void update(T1 &a, T2 b) { a += b; if (a > Mod) a %= Mod; } inline void IN(void) { return; } template <typename First, typename... Rest> void IN(First &first, Rest &...rest) { cin >> first; IN(rest...); return; } inline void OUT(void) { cout << "\n"; return; } template <typename First, typename... Rest> void OUT(First first, Rest... rest) { cout << first << " "; OUT(rest...); return; } bool pairsort(pll pl, pll pr) { if (pl.first == pr.first) return pl.second > pr.second; return pl.first < pr.first; } int cntbit(ll a, int n, int j) { int res = 0; For(i, j, n) { if (a >> i & 1) { res++; } } return res; } vector<int> make_bit(int a) { vector<int> res; for (int i = 31; i >= 0; i--) if (a & (1 << i)) res.pb(i); return res; } bool stdbit(int a, int b) { return a & (1 << b); } int GCD(int a, int b) { if (b > a) return GCD(b, a); if (a % b == 0) return b; else return GCD(b, a % b); } int LCM(int a, int b) { return a * b / GCD(a, b); } int roundup(int a, int b) { if (a % b == 0) return a / b; else return (a + b) / b; } int rounddown(int a, int b) { if (a % b == 0) return a / b; else { return a / b; } } ll pow(ll a, ll n) { ll res = 1; while (n > 0) { if (n & 1) res *= a; a *= a; n = n >> 1; } return res; } ll GetDiviserCount(ll N) // 約数の個数 { ll res = 1; For(i, 2, sqrt(N) + 1) { ll cnt = 0; while (N % i == 0) { cnt++; N /= i; } res *= (cnt + 1); if (N == 1) break; } if (N != 1) res *= 2; return res; } vll GetDivisor(ll N) // 約数列挙 { vll res; for (ll i = 1; i * i <= N; i++) { if (N % i == 0) { res.pb(i); if (i * i != N) res.pb(N / i); } } sort(All(res)); return res; } template <class Z> struct Matrix { using mat = Matrix<Z>; vector<vector<Z>> m_dat; int m_h; int m_w; Matrix(int h, int w, Z x = 0) : m_h(h), m_w(w), m_dat(h, vector<Z>(w, x)) {} Matrix(vector<vector<Z>> &v) { m_dat = v; m_h = v.size(); m_w = v[0].size(); } vector<Z> &operator[](int idx) { return m_dat[idx]; } mat Multiple(mat &a) { mat C(m_h, a.m_w); for (int i = 0; i < m_h; i++) { for (int j = 0; j < a.m_w; j++) { for (int k = 0; k < m_w; k++) { C[i][j] += m_dat[i][k] * a[k][j]; } } } return C; } mat Pow(ll x) { mat B(m_h, m_w); for (int i = 0; i < m_h; i++) { B[i][i] = 1; } mat A = *this; while (x > 0) { if (x & 1) B = B.Multiple(A); A = A.Multiple(A); x = x >> 1; } return B; } friend ostream &operator<<(ostream &os, const mat &A); }; template <class Z> ostream &operator<<(ostream &os, Matrix<Z> &A) { for (int i = 0; i < A.m_h; i++) { for (int j = 0; j < A.m_w; j++) { os << A.m_dat[i][j] << " "; } os << endl; } return os; } template <class Z> using mat = Matrix<Z>; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % Mod + Mod) % Mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= Mod) x -= Mod; return *this; } mint &operator-=(const mint a) { if ((x += Mod - a.x) >= Mod) x -= Mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= Mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(Mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } friend ostream &operator<<(ostream &os, const mint &a); }; ostream &operator<<(ostream &os, const mint &a) { os << a.x; return os; } struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { assert(n < Mod); fact[0] = 1; for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; } }; //_____________________ following sorce code_________________________// const int max_n = 3 * (1e5) + 1; const int max_m = 83 * (1e5) + 1; int n, m, k; ll N; int h, w; vvi tree; string S; int a, b, c; vi v; int ans; signed main() { cin.tie(0); ios::sync_with_stdio(false); ll n, a, b, m, k, ans; IN(n, a, b); k = n / (a + b); // dump(k); ans = k * a; // dump(ans); m = n - (k * (a + b)); if (m > a) ans += a; else ans += m; // dump(ans); cout << ans << endl; // for(auto c : ans){cout << c << endl;} // cout << fixed << setprecision(15) << ans << endl; return 0; }
insert
322
322
322
323
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, a, b; cin >> n >> a >> b; ll r = (a % 10 + b % 10) % 10; ll t = (n % 10 / r % 10) % 10; ll w = (n % 10 % r % 10) % 10; ll d = (t % 10 * a % 10) % 10 + w % 10; cout << d % 10 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, a, b; cin >> n >> a >> b; ll r = (a + b); ll t = (n / r); ll w = (n % r); ll d = (t * a) + min(a, w); cout << d << endl; return 0; }
replace
8
13
8
13
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; int a = 0; int b = 0; int x = 0; int y = 0; int s = 0; cin >> n; cin >> a; cin >> b; x = n / (a + b); y = n % (a + b); if (y > a) { s = a * (x + 1); } else { s += a * x + y; } cout << s << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t n = 0; int64_t a = 0; int64_t b = 0; int64_t x = 0; int64_t y = 0; int64_t s = 0; cin >> n; cin >> a; cin >> b; x = n / (a + b); y = n % (a + b); if (y > a) { s = a * (x + 1); } else { s += a * x + y; } cout << s << endl; }
replace
4
10
4
10
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, A, B; cin >> N >> A >> B; ll x = 0; ll ans = 0; bool f = false; while (x < N) { if (!f) { if (x + A > N) { ans += N - x; break; } ans += A; x += A; } else { x += B; } f = 1 - f; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, A, B; cin >> N >> A >> B; ll x = 0; ll ans = N / (A + B) * A + min(N % (A + B), A); cout << ans << endl; return 0; }
replace
10
28
10
11
TLE
p02754
C++
Time Limit Exceeded
#include <iostream> #include <string> #include <vector> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; long long ans = 0; while (n > 0) { if (n - a < 0) { ans += n; break; } n -= a; ans += a; n -= b; } cout << ans; return 0; }
#include <iostream> #include <string> #include <vector> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; long long ans = 0; long long key = n / (a + b); long long dog = n % (a + b); if (dog > a) dog = a; ans = key * a + dog; cout << ans; return 0; }
replace
8
18
8
13
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << (n / (a + b)) * a + ((n % (a + b)) > a ? a : (n % (a + b))) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int n, a, b; cin >> n >> a >> b; cout << (n / (a + b)) * a + ((n % (a + b)) > a ? a : (n % (a + b))) << endl; return 0; }
replace
4
5
4
5
0
p02754
C++
Runtime Error
#include <algorithm> #include <iostream> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << (n / (a + b) * a + min(a, n % (a + b))) << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << (n / (a + b) * a + min(a, n % (a + b))) << endl; return 0; }
replace
4
5
4
5
0
p02754
C++
Time Limit Exceeded
#include <iostream> int main() { long long n, b, r; std::cin >> n >> b >> r; long long count = 0; if (b == 0) std::cout << 0 << std::endl; else if (b + r == n) std::cout << b << std::endl; else { while (n >= b + r) { count += b; n -= (b + r); } if (n < b) count += n; else count += b; std::cout << count << std::endl; } }
#include <iostream> int main() { long long n, b, r; std::cin >> n >> b >> r; long long count = 0, rem = 0; // if(b==0) // std::cout<<0<<std::endl; // else if(b+r == n) // std::cout<<b<<std::endl; // else{ // while(n>=b+r){ // count += b; // n -= (b+r); // } // if(n<b) // count +=n; // else // count +=b; // std::cout<<count<<std::endl; // } count = (n / (b + r)) * b; rem = n % (b + r); rem = std::min(b, rem); count += rem; std::cout << count << std::endl; }
replace
5
21
5
27
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b, c, total; cin >> a >> b >> c; total = 0; total += a / (b + c) * b; a %= (b + c); for (int i = 0; i < a && i < b; i++) total++; cout << total << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t N, A, B, total; cin >> N >> A >> B; total = N / (A + B) * A; N %= (A + B); total += min(N, A); cout << total << endl; }
replace
4
11
4
9
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, a, b; cin >> n >> a >> b; cout << n / (a + b) * a + min(n % (a + b), a); return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, a, b; cin >> n >> a >> b; cout << n / (a + b) * a + min(n % (a + b), a); return 0; }
replace
9
10
9
10
0
p02754
C++
Runtime Error
#define _USE_MATH_DEFINES #include <algorithm> #include <array> #include <cfloat> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <tuple> #include <vector> using ll = long long; using namespace std; // LLONG_MAX = 90^18 #define int long long #define CONTAINS(v, n) (find((v).begin(), (v).end(), (n)) != (v).end()) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define ARY_SORT(a, size) sort((a), (a) + (size)) #define REMOVE(v, a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end())) #define REVERSE(v) (reverse((v).begin(), (v).end())) #define ARY_REVERSE(v, a) (reverse((v), (v) + (a))) #define LOWER_BOUND(v, a) (lower_bound((v).begin(), (v).end(), (a))) #define UPPER_BOUND(v, a) (upper_bound((v).begin(), (v).end(), (a))) #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define CONTAINS_MAP(m, a) (m).find((a)) != m.end() void YesNo(bool b) { cout << (b ? "Yes" : "No"); } void Yes() { cout << "Yes"; } void No() { cout << "No"; } // max_element signed main() { int N, A, B; cin >> N >> A >> B; if (A == 0) { cout << A << endl; return 0; } int cnt = (N / (A + B)); int m = N % (cnt * (A + B)); int ans = cnt * A; ans += min(m, A); cout << ans << endl; }
#define _USE_MATH_DEFINES #include <algorithm> #include <array> #include <cfloat> #include <climits> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <tuple> #include <vector> using ll = long long; using namespace std; // LLONG_MAX = 90^18 #define int long long #define CONTAINS(v, n) (find((v).begin(), (v).end(), (n)) != (v).end()) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define ARY_SORT(a, size) sort((a), (a) + (size)) #define REMOVE(v, a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end())) #define REVERSE(v) (reverse((v).begin(), (v).end())) #define ARY_REVERSE(v, a) (reverse((v), (v) + (a))) #define LOWER_BOUND(v, a) (lower_bound((v).begin(), (v).end(), (a))) #define UPPER_BOUND(v, a) (upper_bound((v).begin(), (v).end(), (a))) #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define CONTAINS_MAP(m, a) (m).find((a)) != m.end() void YesNo(bool b) { cout << (b ? "Yes" : "No"); } void Yes() { cout << "Yes"; } void No() { cout << "No"; } // max_element signed main() { int N, A, B; cin >> N >> A >> B; if (A == 0) { cout << A << endl; return 0; } int cnt = (N / (A + B)); int m = (cnt > 0) ? N % (cnt * (A + B)) : N; int ans = cnt * A; ans += min(m, A); cout << ans << endl; }
replace
50
52
50
51
0
p02754
C++
Runtime Error
#include <cmath> #include <iostream> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; cout << n / (a + b) * a + min(n % (a + b), a) << endl; return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << n / (a + b) * a + min(n % (a + b), a) << endl; return 0; }
replace
4
5
4
5
0
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { ll n, a, b; cin >> n >> a >> b; ll ans = 0; if (a > 0) { // nの数だけLoopを回し、nがa+bより大きいか判別する while (a + b < n) { if (a + b < n) { n -= (a + b); ans += a; } } // nがaより大きいか判別する if (a > n) ans += n; else ans += a; } cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { ll n, a, b; cin >> n >> a >> b; // ボールの周期に着目する ll c = a + b; ll ans = a * (n / c); // ボールの周期を超えて切れた場合は、小さい方を足す ans += min(n % c, a); cout << ans << endl; }
replace
9
24
9
15
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N, A, B; cin >> N >> A >> B; ll ans = 0; if (A == 0) { cout << 0; return 0; } ll count = 0; int flag = 0; while (count < N) { if (flag == 0) { count += A; ans += A; flag = 1; continue; } if (flag == 1) { count += B; flag = 0; } } if (flag == 1) ans -= count - N; cout << ans; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N, A, B; cin >> N >> A >> B; ll ans = 0; if (A == 0) { cout << 0; return 0; } ll a, b; a = N / (A + B); b = (N - a * (A + B)); if (b < A) ans = a * A + (N - a * (A + B)); if (b >= A) ans = (a + 1) * A; cout << ans; }
replace
11
27
11
18
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int INT_INF = 1e9; const ll INF = 1LL << 30; int main() { ll n, a, b; cin >> n >> a >> b; ll sum = 0; map<char, ll> m; while (1) { for (int i = 0; i < a; i++) { if (sum == n) break; m['b']++; sum++; } for (int i = 0; i < b; i++) { if (sum == n) break; m['a']++; sum++; } if (sum == n) break; } cout << m['b'] << endl; }
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int INT_INF = 1e9; const ll INF = 1LL << 30; int main() { ll n, a, b; cin >> n >> a >> b; ll c = a + b; ll d = n / c; ll e = n % c; if (a < e) e = a; cout << d * a + e << endl; }
replace
11
32
11
17
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define ll long long using namespace std; signed main() { ll n, b, a; ll cun = 1, c = 0; cin >> n >> b >> a; for (ll i = 0; i < n; i++) { if (cun <= b && b != 0) { c++; cun++; } else if (cun - b < a) { cun++; } else { cun = 1; } } cout << c << "\n"; return (0); }
#include <bits/stdc++.h> #define ll long long using namespace std; signed main() { ll n, b, a, x, y; cin >> n >> a >> b; x = n / (a + b); y = min(a, n % (a + b)); cout << x * a + y << "\n"; return (0); }
replace
4
18
4
9
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // cin.ignore(); // better to use 2 times getline(cin,s); // g++ iterator.cpp -std=c++17 // cout << (A + B == C ? "YES" : "NO") << endl; //__gcd(a,b) #define pb push_back #define mk make_pair #define vll vector<ll> #define mll map<ll, ll> #define mlli map<ll, ll>::iterator #define size size() #define endl "\n" #define ll long long int #define ld long double void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main(void) { fast(); int n, a, b; cin >> n >> a >> b; cout << (a * (n / (a + b))) + (min(n % (a + b), a)) << endl; }
#include <bits/stdc++.h> using namespace std; // cin.ignore(); // better to use 2 times getline(cin,s); // g++ iterator.cpp -std=c++17 // cout << (A + B == C ? "YES" : "NO") << endl; //__gcd(a,b) #define pb push_back #define mk make_pair #define vll vector<ll> #define mll map<ll, ll> #define mlli map<ll, ll>::iterator #define size size() #define endl "\n" #define ll long long int #define ld long double void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main(void) { fast(); ll n, a, b; cin >> n >> a >> b; cout << (a * (n / (a + b))) + (min(n % (a + b), a)) << endl; }
replace
23
24
23
24
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C; cin >> A >> B >> C; cout << A / (B + C) * B + min(B, A % (B + C)) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long A, B, C; cin >> A >> B >> C; cout << A / (B + C) * B + min(B, A % (B + C)) << endl; return 0; }
replace
3
4
3
4
0
p02754
C++
Time Limit Exceeded
#include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <stack> #include <vector> #define DEBUG 1 using namespace std; typedef long long LL; typedef vector<LL> VL; typedef vector<vector<LL>> VVL; typedef vector<vector<char>> VVC; typedef vector<string> VS; typedef vector<pair<LL, LL>> VP; typedef pair<LL, LL> PL; #define REPD(i, a, b) for (LL i = (a); i < (b); i++) #define REP(i, n) REPD(i, 0, n) LL llRead() { LL a; cin >> a; return a; }; string stringRead() { string a; cin >> a; return a; }; vector<LL> vlRead(LL a) { vector<LL> rv; REP(i, a) { LL input; cin >> input; rv.push_back(input); } return rv; } vector<string> vsRead(LL a) { vector<string> rv; REP(i, a) { string input; cin >> input; rv.push_back(input); } return rv; } VP vpRead(LL n) { VP rv; REP(i, n) { auto a = llRead(); auto b = llRead(); rv.push_back(make_pair(a, b)); } return rv; } VVL vvlRead(LL a, LL b) { vector<vector<LL>> rv; REP(i, a) { rv.push_back(vector<LL>()); REP(j, b) { LL input; cin >> input; rv.at(i).push_back(input); } } return rv; } VVC vvcRead(LL a, LL b) { VVC rv; REP(i, a) { rv.push_back(vector<char>()); REP(j, b) { char input; cin >> input; rv.at(i).push_back(input); } } return rv; } #if DEBUG #define DEBUG_VECTOR_NEWLINE #define debug(d) debug1(__LINE__, #d, d) void debug1(LL line, const char *name, VL &v) { cout << line << ":" << name << ":vector<LL>(" << v.size() << ") "; REP(i, (LL)v.size()) { cout << v.at(i) << " "; } cout << endl; } void debug1(LL line, const char *name, double i) { cout << line << ":" << name << ":double " << i << endl; ; } void debug1(LL line, const char *name, LL i) { cout << line << ":" << name << ":LL " << i << endl; ; } void debug1(LL line, const char *name, VS &v) { cout << line << ":" << name << ":vector<string>(" << v.size() << ") "; REP(i, (LL)v.size()) { cout << v.at(i) << " "; } cout << endl; } void debug1(LL line, const char *name, VVL &v) { cout << line << ":" << name << ":vector<vector<LL>>(" << v.size() << ") "; #ifdef DEBUG_VECTOR_NEWLINE cout << endl; #endif REP(i, (LL)v.size()) { REP(j, (LL)v.at(i).size()) { cout << v.at(i).at(j) << " "; } cout << ", "; #ifdef DEBUG_VECTOR_NEWLINE cout << endl; #endif } cout << endl; } void debug1(LL line, const char *name, VVC &v) { cout << line << ":" << name << ":vector<vector<char>>(" << v.size() << ") "; #ifdef DEBUG_VECTOR_NEWLINE cout << endl; #endif REP(i, (LL)v.size()) { REP(j, (LL)v.at(i).size()) { cout << v.at(i).at(j) << " "; } cout << ", "; #ifdef DEBUG_VECTOR_NEWLINE cout << endl; #endif } cout << endl; } void debug1(LL line, const char *name, char *s) { cout << line << ":" << name << ":char* " << s << endl; ; } void debug1(LL line, const char *name, char c) { cout << line << ":" << name << ":char " << c << endl; ; } void debug1(LL line, const char *name, string &s) { cout << line << ":" << name << ":string " << s << endl; ; } void debug1(LL line, const char *name, vector<const char *> &v) { cout << line << ":" << name << ":vector<const char*>(" << v.size() << ") "; REP(i, (LL)v.size()) { cout << v.at(i) << " "; } cout << endl; } void debug1(LL line, const char *name, priority_queue<LL> &p) { cout << line << ":" << name << ":priority_queue<LL>(" << p.size() << ") "; priority_queue<LL> copy = p; while (!copy.empty()) { cout << copy.top() << " "; copy.pop(); } cout << endl; } void debug1(LL line, const char *name, vector<pair<LL, LL>> &v) { cout << line << ":" << name << ":vector<pair<LL,LL>>(" << v.size() << ") "; REP(i, (LL)v.size()) { cout << v.at(i).first << "," << v.at(i).second << " "; } cout << endl; } void debug1(LL line, const char *name, map<LL, LL> &m) { cout << line << ":" << name << ":map<LL,LL>(" << m.size() << ") "; for (auto p : m) { cout << p.first << "," << p.second << " "; } cout << endl; } void debug1(LL line, const char *name, multimap<LL, LL> &m) { cout << line << ":" << name << ":map<LL,LL>(" << m.size() << ") "; for (auto p : m) { cout << p.first << "," << p.second << " "; } cout << endl; } void debug1(LL line, const char *name, pair<LL, LL> &v) { cout << line << ":" << name << ":pair<LL,LL> " << v.first << "," << v.second << endl; } #else #define debug(n) #endif #define BASE (1000000007) LL factm(LL n) { debug(n); LL ret = 1; REPD(i, 2, n + 1) { ret *= i; ret = ret % BASE; } debug(ret); return ret; } LL inv(LL a) { LL b = BASE, u = 1, v = 0; while (b) { LL t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= BASE; if (u < 0) u += BASE; return u; } int main(int argc, const char *argv[]) { cout.precision(16); // source code auto N = llRead(); auto A = llRead(); auto B = llRead(); auto n = N; LL ans = 0; while (n > 0) { if (n < A) { ans += n; n = 0; break; } n -= A; ans += A; if (n < B) { break; } n -= B; } cout << ans << endl; return 0; }
#include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <stack> #include <vector> #define DEBUG 1 using namespace std; typedef long long LL; typedef vector<LL> VL; typedef vector<vector<LL>> VVL; typedef vector<vector<char>> VVC; typedef vector<string> VS; typedef vector<pair<LL, LL>> VP; typedef pair<LL, LL> PL; #define REPD(i, a, b) for (LL i = (a); i < (b); i++) #define REP(i, n) REPD(i, 0, n) LL llRead() { LL a; cin >> a; return a; }; string stringRead() { string a; cin >> a; return a; }; vector<LL> vlRead(LL a) { vector<LL> rv; REP(i, a) { LL input; cin >> input; rv.push_back(input); } return rv; } vector<string> vsRead(LL a) { vector<string> rv; REP(i, a) { string input; cin >> input; rv.push_back(input); } return rv; } VP vpRead(LL n) { VP rv; REP(i, n) { auto a = llRead(); auto b = llRead(); rv.push_back(make_pair(a, b)); } return rv; } VVL vvlRead(LL a, LL b) { vector<vector<LL>> rv; REP(i, a) { rv.push_back(vector<LL>()); REP(j, b) { LL input; cin >> input; rv.at(i).push_back(input); } } return rv; } VVC vvcRead(LL a, LL b) { VVC rv; REP(i, a) { rv.push_back(vector<char>()); REP(j, b) { char input; cin >> input; rv.at(i).push_back(input); } } return rv; } #if DEBUG #define DEBUG_VECTOR_NEWLINE #define debug(d) debug1(__LINE__, #d, d) void debug1(LL line, const char *name, VL &v) { cout << line << ":" << name << ":vector<LL>(" << v.size() << ") "; REP(i, (LL)v.size()) { cout << v.at(i) << " "; } cout << endl; } void debug1(LL line, const char *name, double i) { cout << line << ":" << name << ":double " << i << endl; ; } void debug1(LL line, const char *name, LL i) { cout << line << ":" << name << ":LL " << i << endl; ; } void debug1(LL line, const char *name, VS &v) { cout << line << ":" << name << ":vector<string>(" << v.size() << ") "; REP(i, (LL)v.size()) { cout << v.at(i) << " "; } cout << endl; } void debug1(LL line, const char *name, VVL &v) { cout << line << ":" << name << ":vector<vector<LL>>(" << v.size() << ") "; #ifdef DEBUG_VECTOR_NEWLINE cout << endl; #endif REP(i, (LL)v.size()) { REP(j, (LL)v.at(i).size()) { cout << v.at(i).at(j) << " "; } cout << ", "; #ifdef DEBUG_VECTOR_NEWLINE cout << endl; #endif } cout << endl; } void debug1(LL line, const char *name, VVC &v) { cout << line << ":" << name << ":vector<vector<char>>(" << v.size() << ") "; #ifdef DEBUG_VECTOR_NEWLINE cout << endl; #endif REP(i, (LL)v.size()) { REP(j, (LL)v.at(i).size()) { cout << v.at(i).at(j) << " "; } cout << ", "; #ifdef DEBUG_VECTOR_NEWLINE cout << endl; #endif } cout << endl; } void debug1(LL line, const char *name, char *s) { cout << line << ":" << name << ":char* " << s << endl; ; } void debug1(LL line, const char *name, char c) { cout << line << ":" << name << ":char " << c << endl; ; } void debug1(LL line, const char *name, string &s) { cout << line << ":" << name << ":string " << s << endl; ; } void debug1(LL line, const char *name, vector<const char *> &v) { cout << line << ":" << name << ":vector<const char*>(" << v.size() << ") "; REP(i, (LL)v.size()) { cout << v.at(i) << " "; } cout << endl; } void debug1(LL line, const char *name, priority_queue<LL> &p) { cout << line << ":" << name << ":priority_queue<LL>(" << p.size() << ") "; priority_queue<LL> copy = p; while (!copy.empty()) { cout << copy.top() << " "; copy.pop(); } cout << endl; } void debug1(LL line, const char *name, vector<pair<LL, LL>> &v) { cout << line << ":" << name << ":vector<pair<LL,LL>>(" << v.size() << ") "; REP(i, (LL)v.size()) { cout << v.at(i).first << "," << v.at(i).second << " "; } cout << endl; } void debug1(LL line, const char *name, map<LL, LL> &m) { cout << line << ":" << name << ":map<LL,LL>(" << m.size() << ") "; for (auto p : m) { cout << p.first << "," << p.second << " "; } cout << endl; } void debug1(LL line, const char *name, multimap<LL, LL> &m) { cout << line << ":" << name << ":map<LL,LL>(" << m.size() << ") "; for (auto p : m) { cout << p.first << "," << p.second << " "; } cout << endl; } void debug1(LL line, const char *name, pair<LL, LL> &v) { cout << line << ":" << name << ":pair<LL,LL> " << v.first << "," << v.second << endl; } #else #define debug(n) #endif #define BASE (1000000007) LL factm(LL n) { debug(n); LL ret = 1; REPD(i, 2, n + 1) { ret *= i; ret = ret % BASE; } debug(ret); return ret; } LL inv(LL a) { LL b = BASE, u = 1, v = 0; while (b) { LL t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= BASE; if (u < 0) u += BASE; return u; } int main(int argc, const char *argv[]) { cout.precision(16); // source code auto N = llRead(); auto A = llRead(); auto B = llRead(); auto n = N; LL ans = 0; if (A + B < n) { n = n % (A + B); ans += A * (N / (A + B)); } while (n > 0) { if (n < A) { ans += n; n = 0; break; } n -= A; ans += A; if (n < B) { break; } n -= B; } cout << ans << endl; return 0; }
insert
238
238
238
242
TLE
p02754
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using ull = unsigned long long; using vv = vector<vector<int>>; using P = pair<int, int>; int main() { ull n, a, b; cin >> n >> a >> b; ull cnt = 0, i = 1; while (n >= i * (a + b)) { cnt++; i++; } n -= cnt * (a + b); ull ans; if (n >= a) { ans = cnt * a + a; } else { ans = cnt * a + n; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using ull = unsigned long long; using vv = vector<vector<int>>; using P = pair<int, int>; int main() { ull n, a, b; cin >> n >> a >> b; ull cnt = n / (a + b); n -= cnt * (a + b); ull ans; if (n >= a) { ans = cnt * a + a; } else { ans = cnt * a + n; } cout << ans << endl; return 0; }
replace
11
16
11
13
TLE
p02754
C++
Runtime Error
#include <bits/stdc++.h> // #include<string.h> using namespace std; #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define int long long int #define fi first #define se second #define pub push_back #define mkp make_pair #define pi pair<int, int> #define push push #define all(v) (v).begin(), (v).end() #define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++) #define repd(i, l, r) for (int i = (int)(l); i >= (int)(r); i--) int power(int x, unsigned int y) { int res = 1; while (y > 0) { if (y & 1) { res = res * x; } y = y >> 1; x = x * x; } return res; } int powermod(int x, unsigned int y, int p) { int res = 1; x = x % p; while (y > 0) { if (y & 1) { res = (res * x) % p; } y = y >> 1; x = (x * x) % p; } return res; } #define print2d(mat, n, m) \ { \ for (int i = 0; i < (int)(n); i++) { \ for (int j = 0; j < (m); j++) { \ cout << mat[i][j] << " " \ << "endl"; \ } \ } \ } #define print1d(mat, n) \ { \ for (int i = 0; i < (int)(n); i++) \ cout << mat[i] << " "; \ cout << endl; \ } #define clr(a, x) memmultiset(a, x, sizeof(a)) #define rr(v) for (auto &val : v) #define print(v) \ for (const auto itr : v) { \ cout << itr << ' '; \ } \ cout << endl; #define init(v, x) \ for (auto &itr : v) { \ itr = x; \ } #define minpq(x) x, vector<x>, greater<x> #define ln length() #define sz size() #define inf 1e18; int32_t main() { fastIO #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif int n, a, b; cin >> n >> a >> b; int x = n / (a + b); int y = n % (a + b); cout << x * a + (y <= a ? y : a) << endl; return 0; }
#include <bits/stdc++.h> // #include<string.h> using namespace std; #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define int long long int #define fi first #define se second #define pub push_back #define mkp make_pair #define pi pair<int, int> #define push push #define all(v) (v).begin(), (v).end() #define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++) #define repd(i, l, r) for (int i = (int)(l); i >= (int)(r); i--) int power(int x, unsigned int y) { int res = 1; while (y > 0) { if (y & 1) { res = res * x; } y = y >> 1; x = x * x; } return res; } int powermod(int x, unsigned int y, int p) { int res = 1; x = x % p; while (y > 0) { if (y & 1) { res = (res * x) % p; } y = y >> 1; x = (x * x) % p; } return res; } #define print2d(mat, n, m) \ { \ for (int i = 0; i < (int)(n); i++) { \ for (int j = 0; j < (m); j++) { \ cout << mat[i][j] << " " \ << "endl"; \ } \ } \ } #define print1d(mat, n) \ { \ for (int i = 0; i < (int)(n); i++) \ cout << mat[i] << " "; \ cout << endl; \ } #define clr(a, x) memmultiset(a, x, sizeof(a)) #define rr(v) for (auto &val : v) #define print(v) \ for (const auto itr : v) { \ cout << itr << ' '; \ } \ cout << endl; #define init(v, x) \ for (auto &itr : v) { \ itr = x; \ } #define minpq(x) x, vector<x>, greater<x> #define ln length() #define sz size() #define inf 1e18; int32_t main() { fastIO // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // #endif int n, a, b; cin >> n >> a >> b; int x = n / (a + b); int y = n % (a + b); cout << x * a + (y <= a ? y : a) << endl; return 0; }
replace
73
77
73
78
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) \ ; \ for (int i = 0; i < (n); i++) #define chmin(a, b) \ if ((a) > (b)) \ (a) = (b); #define chmax(a, b) \ if ((a) < (b)) \ (a) = (b); #define vi vector<int> int gcd(int a, int b) { /*a>=0,b>=0,¬(a=b=0)*/ while (min(a, b) > 0) { if (a < b) swap(a, b); a %= b; } return max(a, b); } int dx[] = {0, 1, 0, -1, 1, -1, -1, 1}; int dy[] = {1, 0, -1, 0, 1, 1, -1, -1}; const int MOD = 1e9 + 7; const int INF = 1e18 + 10; /*----------------------------------------------*/ signed main() { int n, a, b; cin >> n >> a >> b; int ans; ans = a * n / (a + b); if (n % (a + b) > 0) ans += min(n - ans / a * (a + b), a); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) \ ; \ for (int i = 0; i < (n); i++) #define chmin(a, b) \ if ((a) > (b)) \ (a) = (b); #define chmax(a, b) \ if ((a) < (b)) \ (a) = (b); #define vi vector<int> int gcd(int a, int b) { /*a>=0,b>=0,¬(a=b=0)*/ while (min(a, b) > 0) { if (a < b) swap(a, b); a %= b; } return max(a, b); } int dx[] = {0, 1, 0, -1, 1, -1, -1, 1}; int dy[] = {1, 0, -1, 0, 1, 1, -1, -1}; const int MOD = 1e9 + 7; const int INF = 1e18 + 10; /*----------------------------------------------*/ signed main() { int n, a, b; cin >> n >> a >> b; int ans; ans = n / (a + b) * a; ans += min(n - n / (a + b) * (a + b), a); cout << ans << endl; return 0; }
replace
33
36
33
35
0
p02754
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; cout << a / (b + c) * b + min(b, a % (b + c)); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; cout << a / (b + c) * b + min(b, a % (b + c)); return 0; }
replace
3
4
3
4
0
p02755
Python
Runtime Error
A, B = map(int, input().split()) a = [i for i in range(1, 1001) if int(i * 0.08) == A] b = [i for i in range(1, 1001) if int(i * 0.1) == B] print(min(set(a) & set(b)))
A, B = map(int, input().split()) a = [i for i in range(1, 1001) if int(i * 0.08) == A] b = [i for i in range(1, 1001) if int(i * 0.1) == B] c = set(a) & set(b) if len(c): print(min(c)) else: print(-1)
replace
3
4
3
8
0
p02755
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define REP(i, a, b) for (int i = int(a); i < (int)b; ++i) #define Graph vector<vecctor<ll>> #define pairs vector<pair<ll, ll>> #define pb push_back using namespace std; using ll = long long; const ll INF = 1e18; const double PI = acos(-1); template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } const ll mod = 1000000007; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) const { return mint(*this) /= a; } }; istream &operator>>(istream &is, const mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { assert(n < mod); fact[0] = 1; for (int i = 1; i <= n; ++i) { fact[i] = fact[i - 1] * i; } ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) { ifact[i - 1] = ifact[i] * i; } } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; } }; ll modpow(ll p, ll q) { if (q == 0) return 1; if (q % 2 == 0) { ll x = modpow(p, q / 2); return x * x % mod; } else { return modpow(p, q - 1) * p % mod; } } ll choose(ll n, ll k) { ll x = 1, y = 1; rep(i, k) { x = x * (n - i) % mod; y = y * (k - i) % mod; } y = modpow(y, mod - 2); return x * y % mod; } int main(void) { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int a, b, ans = 1e8; cin >> a >> b; for (int i = 20000; i > 0; ++i) { int p = i * 8 / 100, q = i * 10 / 100; if (p == a && q == b) { ans = i; } } if (ans == 1e8) cout << -1 << endl; else cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)n; ++i) #define REP(i, a, b) for (int i = int(a); i < (int)b; ++i) #define Graph vector<vecctor<ll>> #define pairs vector<pair<ll, ll>> #define pb push_back using namespace std; using ll = long long; const ll INF = 1e18; const double PI = acos(-1); template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } const ll mod = 1000000007; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) const { return mint(*this) /= a; } }; istream &operator>>(istream &is, const mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } struct combination { vector<mint> fact, ifact; combination(int n) : fact(n + 1), ifact(n + 1) { assert(n < mod); fact[0] = 1; for (int i = 1; i <= n; ++i) { fact[i] = fact[i - 1] * i; } ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) { ifact[i - 1] = ifact[i] * i; } } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; } }; ll modpow(ll p, ll q) { if (q == 0) return 1; if (q % 2 == 0) { ll x = modpow(p, q / 2); return x * x % mod; } else { return modpow(p, q - 1) * p % mod; } } ll choose(ll n, ll k) { ll x = 1, y = 1; rep(i, k) { x = x * (n - i) % mod; y = y * (k - i) % mod; } y = modpow(y, mod - 2); return x * y % mod; } int main(void) { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int a, b, ans = 1e8; cin >> a >> b; for (int i = 20000; i > 0; --i) { int p = i * 8 / 100, q = i * 10 / 100; if (p == a && q == b) { ans = i; } } if (ans == 1e8) cout << -1 << endl; else cout << ans << endl; return 0; }
replace
112
113
112
113
TLE
p02755
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; for (int i = 0; i < 1100; i++) { if (i * 2 / 25 == a && i / 10 == b) { cout << i << endl; break; } else if (i == 1099) { cout << -1 << endl; } } return -1; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; for (int i = 0; i < 1100; i++) { if (i * 2 / 25 == a && i / 10 == b) { cout << i << endl; break; } else if (i == 1099) { cout << -1 << endl; } } return 0; }
replace
14
15
14
15
255
p02755
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define cinsc \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(0); #define all(cont) cont.begin(), cont.end() #define rall(cont) cont.end(), cont.begin() #define FOR(i, n) for (int i = 0; i < n; i++) #define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++) #define IN(A, B, C) assert(B <= A && A <= C) #define MP make_pair #define PB push_back #define INF (int)1e9 #define EPS 1e-9 #define PI 3.1415926535897932384626433832795 #define MOD 1000000007 #define read(type) readInt<type>() const double pi = acos(-1.0); typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<string> VS; typedef vector<PII> VII; typedef vector<VI> VVI; typedef map<int, int> MPII; typedef set<int> SETI; typedef multiset<int> MSETI; typedef long int int32; typedef unsigned long int uint32; typedef long long int int64; typedef unsigned long long int uint64; void in_o() { cinsc; #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } int main() { in_o(); int a, b, x, y; cin >> a >> b; for (int i = 1; i < 10001; i++) { x = i * 8 / 100; y = i * 10 / 100; if (x == a && y == b) { cout << i << endl; return 0; } } cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define cinsc \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(0); #define all(cont) cont.begin(), cont.end() #define rall(cont) cont.end(), cont.begin() #define FOR(i, n) for (int i = 0; i < n; i++) #define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++) #define IN(A, B, C) assert(B <= A && A <= C) #define MP make_pair #define PB push_back #define INF (int)1e9 #define EPS 1e-9 #define PI 3.1415926535897932384626433832795 #define MOD 1000000007 #define read(type) readInt<type>() const double pi = acos(-1.0); typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<string> VS; typedef vector<PII> VII; typedef vector<VI> VVI; typedef map<int, int> MPII; typedef set<int> SETI; typedef multiset<int> MSETI; typedef long int int32; typedef unsigned long int uint32; typedef long long int int64; typedef unsigned long long int uint64; void in_o() { cinsc; #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } int main() { // in_o(); int a, b, x, y; cin >> a >> b; for (int i = 1; i < 10001; i++) { x = i * 8 / 100; y = i * 10 / 100; if (x == a && y == b) { cout << i << endl; return 0; } } cout << -1 << endl; return 0; }
replace
42
43
42
43
0
p02755
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; bool x = true; int ans = 0; while (x) { if (floor(ans * 0.08) == a && floor(ans * 0.1) == b) { cout << ans << endl; return 0; } ans++; } cout << -1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; bool x = true; int ans = 0; while (x && ans < 1010) { if (floor(ans * 0.08) == a && floor(ans * 0.1) == b) { cout << ans << endl; return 0; } ans++; } cout << -1 << endl; }
replace
8
9
8
9
TLE
p02755
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; for (int i = 1; i <= 10000000; i++) { int tmp = i * 8, tmp2 = i * 10; tmp /= 100; tmp2 /= 100; if (tmp == A && tmp2 == B) { cout << i << endl; return 0; } } assert(false); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; for (int i = 1; i <= 10000000; i++) { int tmp = i * 8, tmp2 = i * 10; tmp /= 100; tmp2 /= 100; if (tmp == A && tmp2 == B) { cout << i << endl; return 0; } } cout << -1 << endl; return 0; }
replace
15
16
15
16
0
p02755
C++
Time Limit Exceeded
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } const ll INF = 1LL << 60; int main() { int A, B; cin >> A >> B; int ans = 0; while (1) { ans++; // printf("%d %d %d\n",ans,(int)(ans*0.08),(int)(ans*0.1)); if ((int)(ans * 0.08) == A) { if ((int)(ans * 0.1) == B) { break; } } if (ans > 10500) { cout << "-1" << endl; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } const ll INF = 1LL << 60; int main() { int A, B; cin >> A >> B; int ans = 0; while (1) { ans++; // printf("%d %d %d\n",ans,(int)(ans*0.08),(int)(ans*0.1)); if ((int)(ans * 0.08) == A) { if ((int)(ans * 0.1) == B) { break; } } if (ans > 10500) { cout << "-1" << endl; return 0; } } cout << ans << endl; return 0; }
insert
38
38
38
39
TLE
p02755
C++
Runtime Error
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; /**** Type Define ****/ typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, P> Q; /**** Const List ****/ const ll INF = 1LL << 60; const ll mod = 1000000007; const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, -1, 0, 1}; const ll NCK_MAX = 510000; /**** General Functions ****/ ll ketawa(ll n) { ll a = 0; while (n != 0) { a += n % 10; n /= 10; } return a; } ll RepeatSquaring(ll N, ll P, ll M) { // pow->double if (P == 0) return 1; if (P % 2 == 0) { ll t = RepeatSquaring(N, P / 2, M); return (t % M) * (t % M) % M; } return (N * RepeatSquaring(N, P - 1, M)) % M; } ll RS(ll N, ll P) { // modがだるいときにつかう if (P == 0) return 1; if (P % 2 == 0) { ll t = RS(N, P / 2); return t * t; } return (N * RS(N, P - 1)); } map<ll, int> prime_factor(ll n) { map<ll, int> ret; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } bool IsPrime(ll a) { // order root a if (a == 1) return false; for (int i = 2; i * i <= a; i++) { if (a % i == 0 && a != i) { return false; } } return true; } ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll extgcd(ll a, ll b, ll &x, ll &y) { if (b == 0) { x = 1, y = 0; return a; } ll q = a / b, g = extgcd(b, a - q * b, x, y); ll z = x - q * y; x = y; y = z; return g; } ll invmod(ll a, ll m) { // a^-1 mod m ll x, y; extgcd(a, m, x, y); x %= m; if (x < 0) x += m; return x; } ll *fac, *finv, *inv; void nCk_init(ll mod) { fac = new ll[NCK_MAX]; finv = new ll[NCK_MAX]; inv = new ll[NCK_MAX]; fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll i = 2; i < NCK_MAX; i++) { fac[i] = fac[i - 1] * i % mod; inv[i] = mod - inv[mod % i] * (mod / i) % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } ll nCk(ll n, ll k, ll mod) { if (fac == NULL) nCk_init(mod); if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % mod) % mod; } ll lmin(ll a, ll b) { return a > b ? b : a; }; ll lmax(ll a, ll b) { return a > b ? a : b; }; ll lsum(ll a, ll b) { return a + b; }; /**** Zip ****/ template <typename T> class Zip { vector<T> d; bool flag; public: Zip() { flag = false; } void add(T x) { d.push_back(x); flag = true; } ll getNum(T x) { // T need to have operator < !! if (flag) { sort(d.begin(), d.end()); d.erase(unique(d.begin(), d.end()), d.end()); flag = false; } return lower_bound(d.begin(), d.end(), x) - d.begin(); } ll size() { if (flag) { sort(d.begin(), d.end()); d.erase(unique(d.begin(), d.end()), d.end()); flag = false; } return (ll)d.size(); } }; /**** Union Find ****/ class UnionFind { vector<ll> par, rank; // par > 0: number, par < 0: -par public: void init(ll n) { par.resize(n, 1); rank.resize(n, 0); } ll getSize(ll x) { return par[find(x)]; } ll find(ll x) { if (par[x] > 0) return x; return -(par[x] = -find(-par[x])); } void merge(ll x, ll y) { x = find(x); y = find(y); if (x == y) return; if (rank[x] < rank[y]) { par[y] += par[x]; par[x] = -y; } else { par[x] += par[y]; par[y] = -x; if (rank[x] == rank[y]) rank[x]++; } } bool isSame(ll x, ll y) { return find(x) == find(y); } }; /**** Segment Tree ****/ class SegmentTree { public: vector<pair<double, double>> node; // node[0]は使用しない ll n; // データの個数(nodeの最下層には何個並んでいるか) pair<double, double> initial_value; // 初期値 public: void Init(ll n_, pair<double, double> initial_value_) { n = 1; while (n < n_) n *= 2; node.resize(2 * n); for (ll i = 0; i < 2 * n; i++) { node[i] = initial_value_; } initial_value = initial_value_; } void Update(ll k, pair<double, double> a) { // node[k]をaにする // それに従って先祖も変わっていく k += n; node[k] = a; while (k > 1) { k = k / 2; node[k] = pair<double, double>( node[k * 2].first * node[k * 2 + 1].first, node[k * 2].second * node[k * 2 + 1].first + node[k * 2 + 1].second); } } /*void Watch(){ for(ll i=0;i<2*n;i++){ cout<<node[i]<<endl; } }*/ double Query() { //[a,b) return node[1].first + node[1].second; } }; /**** LIS ****/ ll lis(ll *a, ll n, ll *dp) { fill(dp, dp + n, INF); // INFを代入 for (ll i = 0; i < n; i++) *lower_bound(dp, dp + n, a[i]) = a[i]; return (ll)(lower_bound(dp, dp + n, INF) - dp); } /**** main function ****/ ll n, a[3000], b[300]; ll x, y; string s; int main() { cin >> x >> y; for (ll i = 1; i < 3000; i++) { ll aa = i * 1.08; ll bb = i * 1.1; a[i] = aa; b[i] = bb; if (aa - i == x && bb - i == y) { cout << i << endl; return 0; } } cout << -1 << endl; }
#include <algorithm> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <utility> #include <vector> using namespace std; /**** Type Define ****/ typedef long long ll; typedef pair<ll, ll> P; typedef pair<ll, P> Q; /**** Const List ****/ const ll INF = 1LL << 60; const ll mod = 1000000007; const ll dx[4] = {1, 0, -1, 0}; const ll dy[4] = {0, -1, 0, 1}; const ll NCK_MAX = 510000; /**** General Functions ****/ ll ketawa(ll n) { ll a = 0; while (n != 0) { a += n % 10; n /= 10; } return a; } ll RepeatSquaring(ll N, ll P, ll M) { // pow->double if (P == 0) return 1; if (P % 2 == 0) { ll t = RepeatSquaring(N, P / 2, M); return (t % M) * (t % M) % M; } return (N * RepeatSquaring(N, P - 1, M)) % M; } ll RS(ll N, ll P) { // modがだるいときにつかう if (P == 0) return 1; if (P % 2 == 0) { ll t = RS(N, P / 2); return t * t; } return (N * RS(N, P - 1)); } map<ll, int> prime_factor(ll n) { map<ll, int> ret; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } bool IsPrime(ll a) { // order root a if (a == 1) return false; for (int i = 2; i * i <= a; i++) { if (a % i == 0 && a != i) { return false; } } return true; } ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll extgcd(ll a, ll b, ll &x, ll &y) { if (b == 0) { x = 1, y = 0; return a; } ll q = a / b, g = extgcd(b, a - q * b, x, y); ll z = x - q * y; x = y; y = z; return g; } ll invmod(ll a, ll m) { // a^-1 mod m ll x, y; extgcd(a, m, x, y); x %= m; if (x < 0) x += m; return x; } ll *fac, *finv, *inv; void nCk_init(ll mod) { fac = new ll[NCK_MAX]; finv = new ll[NCK_MAX]; inv = new ll[NCK_MAX]; fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll i = 2; i < NCK_MAX; i++) { fac[i] = fac[i - 1] * i % mod; inv[i] = mod - inv[mod % i] * (mod / i) % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } ll nCk(ll n, ll k, ll mod) { if (fac == NULL) nCk_init(mod); if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % mod) % mod; } ll lmin(ll a, ll b) { return a > b ? b : a; }; ll lmax(ll a, ll b) { return a > b ? a : b; }; ll lsum(ll a, ll b) { return a + b; }; /**** Zip ****/ template <typename T> class Zip { vector<T> d; bool flag; public: Zip() { flag = false; } void add(T x) { d.push_back(x); flag = true; } ll getNum(T x) { // T need to have operator < !! if (flag) { sort(d.begin(), d.end()); d.erase(unique(d.begin(), d.end()), d.end()); flag = false; } return lower_bound(d.begin(), d.end(), x) - d.begin(); } ll size() { if (flag) { sort(d.begin(), d.end()); d.erase(unique(d.begin(), d.end()), d.end()); flag = false; } return (ll)d.size(); } }; /**** Union Find ****/ class UnionFind { vector<ll> par, rank; // par > 0: number, par < 0: -par public: void init(ll n) { par.resize(n, 1); rank.resize(n, 0); } ll getSize(ll x) { return par[find(x)]; } ll find(ll x) { if (par[x] > 0) return x; return -(par[x] = -find(-par[x])); } void merge(ll x, ll y) { x = find(x); y = find(y); if (x == y) return; if (rank[x] < rank[y]) { par[y] += par[x]; par[x] = -y; } else { par[x] += par[y]; par[y] = -x; if (rank[x] == rank[y]) rank[x]++; } } bool isSame(ll x, ll y) { return find(x) == find(y); } }; /**** Segment Tree ****/ class SegmentTree { public: vector<pair<double, double>> node; // node[0]は使用しない ll n; // データの個数(nodeの最下層には何個並んでいるか) pair<double, double> initial_value; // 初期値 public: void Init(ll n_, pair<double, double> initial_value_) { n = 1; while (n < n_) n *= 2; node.resize(2 * n); for (ll i = 0; i < 2 * n; i++) { node[i] = initial_value_; } initial_value = initial_value_; } void Update(ll k, pair<double, double> a) { // node[k]をaにする // それに従って先祖も変わっていく k += n; node[k] = a; while (k > 1) { k = k / 2; node[k] = pair<double, double>( node[k * 2].first * node[k * 2 + 1].first, node[k * 2].second * node[k * 2 + 1].first + node[k * 2 + 1].second); } } /*void Watch(){ for(ll i=0;i<2*n;i++){ cout<<node[i]<<endl; } }*/ double Query() { //[a,b) return node[1].first + node[1].second; } }; /**** LIS ****/ ll lis(ll *a, ll n, ll *dp) { fill(dp, dp + n, INF); // INFを代入 for (ll i = 0; i < n; i++) *lower_bound(dp, dp + n, a[i]) = a[i]; return (ll)(lower_bound(dp, dp + n, INF) - dp); } /**** main function ****/ ll n, a[3000], b[3000]; ll x, y; string s; int main() { cin >> x >> y; for (ll i = 1; i < 3000; i++) { ll aa = i * 1.08; ll bb = i * 1.1; a[i] = aa; b[i] = bb; if (aa - i == x && bb - i == y) { cout << i << endl; return 0; } } cout << -1 << endl; }
replace
249
250
249
250
0
p02755
C++
Time Limit Exceeded
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define E "\n" using namespace std; const long long MOD = (long long)1e9 + 7; int a, b; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> a >> b; int ans; for (int i = 1; 1; i++) { if ((i * 2) / 25 == a && i / 10 == b) { ans = i; break; } } cout << ans << E; // system("pause"); return 0; }
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define E "\n" using namespace std; const long long MOD = (long long)1e9 + 7; int a, b; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> a >> b; int ans; for (int i = 1; 1; i++) { if ((i * 2) / 25 == a && i / 10 == b) { ans = i; break; } if (i > 5000) { ans = -1; break; } } cout << ans << E; // system("pause"); return 0; }
insert
23
23
23
27
TLE
p02755
C++
Runtime Error
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl "\n" #define ll long long #define oo 0x3f3f3f3fLL #define sz(s) (int)(s.size()) #define RT(s) return cout << s, 0 #define INF 0x3f3f3f3f3f3f3f3fLL #define all(v) v.begin(), v.end() #define watch(x) cout << (#x) << " = " << x << endl const int dr[]{-1, -1, 0, 1, 1, 1, 0, -1}; const int dc[]{0, 1, 1, 1, 0, -1, -1, -1}; #if __cplusplus >= 201402L template <typename T> vector<T> create(size_t n) { return vector<T>(n); } template <typename T, typename... Args> auto create(size_t n, Args... args) { return vector<decltype(create<T>(args...))>(n, create<T>(args...)); } #endif void run() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.in", "r", stdin); // freopen("output.out", "w", stdout); #else #endif } int main() { run(); int a, b; cin >> a >> b; for (int i = 1;; i++) { int x = i * 8 / 100; int y = i * 10 / 100; if (x == a && y == b) RT(i); if (x > a) RT(-1); } }
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl "\n" #define ll long long #define oo 0x3f3f3f3fLL #define sz(s) (int)(s.size()) #define RT(s) return cout << s, 0 #define INF 0x3f3f3f3f3f3f3f3fLL #define all(v) v.begin(), v.end() #define watch(x) cout << (#x) << " = " << x << endl const int dr[]{-1, -1, 0, 1, 1, 1, 0, -1}; const int dc[]{0, 1, 1, 1, 0, -1, -1, -1}; #if __cplusplus >= 201402L template <typename T> vector<T> create(size_t n) { return vector<T>(n); } template <typename T, typename... Args> auto create(size_t n, Args... args) { return vector<decltype(create<T>(args...))>(n, create<T>(args...)); } #endif void run() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.in", "r", stdin); // freopen("output.out", "w", stdout); #else #endif } int main() { // run(); int a, b; cin >> a >> b; for (int i = 1;; i++) { int x = i * 8 / 100; int y = i * 10 / 100; if (x == a && y == b) RT(i); if (x > a) RT(-1); } }
replace
32
33
32
33
0
p02755
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int a, b; cin >> a >> b; for (int i = 0; i <= 1250; i++) { int k = i * 0.08; int l = i * 0.1; if (k == a && l == b) { cout << i << endl; exit(1); } } cout << "-1" << endl; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int a, b; cin >> a >> b; for (int i = 0; i <= 1250; i++) { int k = i * 0.08; int l = i * 0.1; if (k == a && l == b) { cout << i << endl; exit(0); } } cout << "-1" << endl; }
replace
12
13
12
13
1
p02755
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define INF 1001001001 #define LINF 1001001001001001001 #define MOD 1000000007 #define MOD2 998244353 template <class T, class U> bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> bool chmin(T &a, const U &b) { if (b < a) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0, _i = (n); i < _i; ++i) #define rep1(i, a, b) for (int a_ = (a), b_ = (b), i = a_; i < b_; ++i) #define repr(i, n) for (int _i = (n), i = _i; i > 0; --i) #define db(x) cerr << #x << " = " << x << " "; #define db2(x, y) \ cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ") "; #define db3(x, y, z) \ cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y \ << ", " << z << ") "; #define ln cout << endl; #define all(a) (a).begin(), (a).end() #define dig(n) to_string(n).length() #define pb push_back #define eb emplace_back #define mp make_pair #define se second #define fi first typedef long long ll; typedef pair<int, int> pii; typedef pair<pii, pii> ppii; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { bool flag = false; ll ans = 0, sum = 0; int oct[120] = {}; int dec[120] = {}; rep(i, 12000) { oct[i] = 0.08 * i; dec[i] = 0.10 * i; // db3(i,oct[i],dec[i]);ln; } int a, b; cin >> a >> b; rep(i, 12000) { if (oct[i] == a && dec[i] == b) { cout << i << endl; return 0; } } // cout <<fixed<<setprecision(16)<< << endl; cout << -1 << endl; // if(flag)cout << "Yes" <<endl; // else cout << "No" <<endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define INF 1001001001 #define LINF 1001001001001001001 #define MOD 1000000007 #define MOD2 998244353 template <class T, class U> bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template <class T, class U> bool chmin(T &a, const U &b) { if (b < a) { a = b; return 1; } return 0; } #define rep(i, n) for (int i = 0, _i = (n); i < _i; ++i) #define rep1(i, a, b) for (int a_ = (a), b_ = (b), i = a_; i < b_; ++i) #define repr(i, n) for (int _i = (n), i = _i; i > 0; --i) #define db(x) cerr << #x << " = " << x << " "; #define db2(x, y) \ cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ") "; #define db3(x, y, z) \ cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y \ << ", " << z << ") "; #define ln cout << endl; #define all(a) (a).begin(), (a).end() #define dig(n) to_string(n).length() #define pb push_back #define eb emplace_back #define mp make_pair #define se second #define fi first typedef long long ll; typedef pair<int, int> pii; typedef pair<pii, pii> ppii; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); } int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { bool flag = false; ll ans = 0, sum = 0; int oct[12000] = {}; int dec[12000] = {}; rep(i, 12000) { oct[i] = 0.08 * i; dec[i] = 0.10 * i; // db3(i,oct[i],dec[i]);ln; } int a, b; cin >> a >> b; rep(i, 12000) { if (oct[i] == a && dec[i] == b) { cout << i << endl; return 0; } } // cout <<fixed<<setprecision(16)<< << endl; cout << -1 << endl; // if(flag)cout << "Yes" <<endl; // else cout << "No" <<endl; return 0; }
replace
58
60
58
60
-11
p02755
C++
Runtime Error
#include <bits/stdc++.h> // #define TASK "file" #define F first #define S second #define ALL(x) (x).begin(), (x).end() using namespace std; typedef long long i64; typedef long double dbl; const dbl PI = acos(-1.0L); const dbl EPS = 1e-12L; mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); namespace task { int a, b; int main() { cin >> a >> b; for (int p = 0; p < 20000; ++p) { if (p * 8 / 100 == a && p / 10 == b) { cout << p << '\n'; return 0; } } cout << -1 << '\n'; } } // namespace task int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.precision(11); cout.setf(ios::fixed); #ifdef _DEBUG freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #elif defined(TASK) freopen(TASK ".in", "r", stdin); freopen(TASK ".out", "w", stdout); #endif return task::main(); }
#include <bits/stdc++.h> // #define TASK "file" #define F first #define S second #define ALL(x) (x).begin(), (x).end() using namespace std; typedef long long i64; typedef long double dbl; const dbl PI = acos(-1.0L); const dbl EPS = 1e-12L; mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); namespace task { int a, b; int main() { cin >> a >> b; for (int p = 0; p < 20000; ++p) { if (p * 8 / 100 == a && p / 10 == b) { cout << p << '\n'; return 0; } } cout << -1 << '\n'; return 0; } } // namespace task int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.precision(11); cout.setf(ios::fixed); #ifdef _DEBUG freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #elif defined(TASK) freopen(TASK ".in", "r", stdin); freopen(TASK ".out", "w", stdout); #endif return task::main(); }
insert
26
26
26
27
0
p02755
C++
Time Limit Exceeded
#include <iostream> #include <string> #include <vector> // using namespace std; using namespace std; int gcd(int a, int b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } int lcm(int a, int b) { return a * b / gcd(a, b); } int main() { uint32_t aa; uint32_t bb; uint32_t max = 0xffffffff; uint32_t min = 10; uint32_t atax; uint32_t btax; std::cin >> aa >> bb; for (uint64_t i = min; i < max; i++) { atax = (i * 108 / 100) - i; btax = (i * 110 / 100) - i; if ((atax == aa) && (btax == bb)) { std::cout << i << std::endl; return 0; } } std::cout << -1 << std::endl; return 0; }
#include <iostream> #include <string> #include <vector> // using namespace std; using namespace std; int gcd(int a, int b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } int lcm(int a, int b) { return a * b / gcd(a, b); } int main() { uint32_t aa; uint32_t bb; uint32_t max = 10000; uint32_t min = 10; uint32_t atax; uint32_t btax; std::cin >> aa >> bb; for (uint64_t i = min; i < max; i++) { atax = (i * 108 / 100) - i; btax = (i * 110 / 100) - i; if ((atax == aa) && (btax == bb)) { std::cout << i << std::endl; return 0; } } std::cout << -1 << std::endl; return 0; }
replace
20
21
20
21
TLE
p02755
C++
Time Limit Exceeded
#include <bits/stdc++.h> using namespace std; #define int long long // Big two primes #define X 1001100011100001111ll #define ll long long #define all(a) a.begin(), a.end() #define sortall(a) sort(all(a)) #define fo(i, n) for (int i = 0; i < n; i++) #define fo1(i, n) for (int i = 1; i <= n; i++) #define loop(i, a, b) for (int i = a; i < b; i++) #define nloop(i, a, b) for (int i = a; i >= b; i--) #define tc(t) \ int t; \ cin >> t; \ while (t--) #define arrip(n) \ int a[n]; \ fo(i, n) cin >> a[i]; #define arrop(n) fo(i, n) cout << a[i] << " "; #define pb push_back #define mp make_pair #define itr(it, a) for (auto it = a.begin(); it != a.end(); it++) #define PI 3.1415926535897932384626 #define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define rr return 0 #define prec(n) fixed << setprecision(n) #define maxpq priority_queue<int> #define minpq priority_queue<int, vector<int>, greater<int>> #define inf (int)(1e18) #define ini(a, i) memset(a, i, sizeof(a)) #define vi vector<int> #define fi first #define se second #define endl "\n" #define pi pair<int, int> #define vpi vector<pi> #define sz(s) s.size() #define bits(n) __builtin_popcount(n) // Count set bits const int MAXN = (int)((1e5) + 100); int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } int max(int a, int b) { if (a > b) return a; else return b; } int min(int a, int b) { if (a < b) return a; else return b; } int32_t main() { #ifndef ONLINE_JUDGE freopen("atcoderi.txt", "r", stdin); freopen("atcodero.txt", "w", stdout); #endif fio; int a, b; cin >> a >> b; int res = -1; for (int i = 1; i < INT_MAX; i++) { // cout << i << endl; double s1 = floor(i * 0.08); // cout << s1 << endl; double s2 = floor(i * 0.1); // cout << s2 << endl; if (s1 == a && s2 == b) { res = i; break; } } cout << res << endl; }
#include <bits/stdc++.h> using namespace std; #define int long long // Big two primes #define X 1001100011100001111ll #define ll long long #define all(a) a.begin(), a.end() #define sortall(a) sort(all(a)) #define fo(i, n) for (int i = 0; i < n; i++) #define fo1(i, n) for (int i = 1; i <= n; i++) #define loop(i, a, b) for (int i = a; i < b; i++) #define nloop(i, a, b) for (int i = a; i >= b; i--) #define tc(t) \ int t; \ cin >> t; \ while (t--) #define arrip(n) \ int a[n]; \ fo(i, n) cin >> a[i]; #define arrop(n) fo(i, n) cout << a[i] << " "; #define pb push_back #define mp make_pair #define itr(it, a) for (auto it = a.begin(); it != a.end(); it++) #define PI 3.1415926535897932384626 #define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define rr return 0 #define prec(n) fixed << setprecision(n) #define maxpq priority_queue<int> #define minpq priority_queue<int, vector<int>, greater<int>> #define inf (int)(1e18) #define ini(a, i) memset(a, i, sizeof(a)) #define vi vector<int> #define fi first #define se second #define endl "\n" #define pi pair<int, int> #define vpi vector<pi> #define sz(s) s.size() #define bits(n) __builtin_popcount(n) // Count set bits const int MAXN = (int)((1e5) + 100); int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } int max(int a, int b) { if (a > b) return a; else return b; } int min(int a, int b) { if (a < b) return a; else return b; } int32_t main() { #ifndef ONLINE_JUDGE freopen("atcoderi.txt", "r", stdin); freopen("atcodero.txt", "w", stdout); #endif fio; int a, b; cin >> a >> b; int res = -1; for (int i = 1; i < 3000; i++) { // cout << i << endl; double s1 = floor(i * 0.08); // cout << s1 << endl; double s2 = floor(i * 0.1); // cout << s2 << endl; if (s1 == a && s2 == b) { res = i; break; } } cout << res << endl; }
replace
70
71
70
71
TLE