# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
233280 |
2020-05-20T08:28:00 Z |
Vimmer |
Segway (COI19_segway) |
C++14 |
|
5 ms |
384 KB |
#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 (int i = 0; i < n; i++)
{
int tp = se.order_of_key(when[i]) % 20;
se.erase(se.find(when[i]));
int ans = when[i] + min(tp, 300 - t);
if (tp == 0)
{
if (t <= 100) when[i] += a[i] - 1;
if (t <= 200) when[i] += b[i] - 1;
if (t <= 300) when[i] += c[i] - 1;
}
se.insert(when[i]);
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 << ans << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |