Submission #849726

#TimeUsernameProblemLanguageResultExecution timeMemory
849726NaserOvertaking (IOI23_overtaking)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> //#define int long long #define ll long long #define endl '\n' #define pii pair<int,int> #define vint vector<int> #define vll vector<ll> #define vpii vector<pii> #define pb push_back #define se second #define fi first #define all(x) x.begin(), x.end() #define graph vector<vector<int>> using namespace std; const int N = (int)2e5 + 69; const int mod = (int)1e4 + 7; const int naser = 3999, tourist = 3816; int power(int a, int b) { int ans = 1; while (b) { if (b % 2) ans *= a; a *= a; b /= 2; } return ans; } ll n, x, m, l, y; vll w, s, t, tmp; void init(int L, int N, vll T, vint W, int X, int M, vint S) { l = L; n = N; x = X; m = M; t = T; w.pb(W[0]); s.resize(m); for (int i = 0; i < m; i++) s[i] = S[i]; tmp.resize(m); tmp[0] = t[0]; for (int i = 1; i < m; i++) { tmp[i] = tmp[i - 1] + ((s[i] - s[i - 1]) * w[0]); } } ll toll(string x){ ll ans = 0; ll tmp = 1; reverse(all(x)); for(auto c : x){ ans+=(c-'0')*tmp; tmp*=10; } return ans; } long long arrival_time(long long Y) { ll ans = Y; for (int i = 1; i < m; i++) { if (tmp[i - 1] < ans) ans = tmp[i]; else ans += (s[i] - s[i - 1]) * x; } string debug = to_string(n); debug+='0'; debug+=to_string(m); debug+='0'; for(int i = 1; i < m; i++){ debug += to_string(s[i]); debug+= '0'; } debug+=to_string(t[0]); debug+='0'; debug+=to_string(w[0]); debug+='0'; debug+=to_string(x); debug+='0'; debug+=to_string(y); debug+='0'; debug+=to_string(ans); return toll(debug); } /*int32_t main() { //init(6, 4, { 20, 10, 40, 0 }, { 5, 20, 20, 30 }, 10, 4, { 0, 1, 3, 6 }); init(6, 1, { 5 }, { 20 }, 10, 5, { 0,2,4,5 ,6 }); while (naser > tourist) { ll Y; cin >> Y; cout << arrival_time(Y) << endl; } }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...