Submission #233275

#TimeUsernameProblemLanguageResultExecution timeMemory
233275VimmerSegway (COI19_segway)C++14
0 / 100
5 ms384 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> //#pragma GCC optimize("unroll-loops") //#pragma GCC optimize("-O3") //#pragma GCC optimize("Ofast") #define sz(x) ll(x.size()) #define N 20015 #define base 1000000 #define M ll(1e9+7) #define F first #define S second #define pb push_back #define in insert #define eb emplace_back #define ed "\n" using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef short int si; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; ordered_set se; int main() { // freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int a[n], b[n], c[n]; for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i]; int m; cin >> m; if (m == 0) { for (int i = 0; i < n; i++) cout << (a[i] + b[i] + c[i]) * 100 << endl; exit(0); } else { int t; cin >> t; int when[n]; for (int i = 0; i < n; i++) { if (t <= 100) when[i] = t * a[i]; else if (t <= 200) when[i] = 100 * a[i] + (t - 100) * b[i]; else when[i] = 100 * (a[i] + b[i]) + (t - 200) * c[i]; se.insert(when[i]); } //for (auto it : se) cout << it << endl; // cout << endl; //cout << endl; for (int i = 0; i < n; i++) { int tp = se.order_of_key(when[i]); int ans = when[i] + min(tp, 300 - t); int tr = t + tp; if (tr <= 100) ans += (b[i] + c[i]) * 100 + a[i] * (100 - tr); else if (tr <= 200) ans += c[i] * 100 + b[i] * (200 - tr); else if (tr <= 300) ans += c[i] * (300 - tr); // cout << when[i] << " "; cout << ans << '\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...