이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |