QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#696654#6691. Orderspppwolf#AC ✓3ms3624kbC++232.4kb2024-11-01 00:08:252024-11-01 00:08:26

Judging History

你现在查看的是最新测评结果

  • [2024-11-01 00:08:26]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3624kb
  • [2024-11-01 00:08:25]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using lll = __int128;
//重载pair<t1, t2>输入
template<class T1, class T2> istream& operator>>(istream& cin, pair<T1, T2>& a) { return cin >> a.first >> a.second; }
//重载vector<t1>输入
template<class T1> istream& operator>>(istream& cin, vector<T1>& a) { for (auto& x : a) cin >> x; return cin; }
//重载最大最小值比较
template<class T1, class T2> bool cmin(T1& x, const T2& y) { if (y < x) { x = y; return 1; } return 0; }
template<class T1, class T2> bool cmax(T1& x, const T2& y) { if (x < y) { x = y; return 1; } return 0; }
//重载i128输出
ostream& operator<<(ostream& cout, lll x) { static char s[60]; if (x < 0) cout << '-', x = -x; int tp = 1; s[0] = '0' + (x % 10); while (x /= 10) s[tp++] = '0' + (x % 10); while (tp--) cout << s[tp]; return cout; }
//重载pair<t1,t2>输出
template<class T1, class T2> ostream& operator<<(ostream& cout, const pair<T1, T2>& a) { return cout << a.first << ' ' << a.second; }
//重载vector<pair<t1, t2>>输出
template<class T1, class T2> ostream& operator<<(ostream& cout, const vector<pair<T1, T2>>& a) { for (auto& x : a) cout << x << '\n'; return cout; }
//重载vector<t1>输出
template<class T1> ostream& operator<<(ostream& cout, vector<T1> a) { int n = a.size(); if (!n) return cout; cout << a[0]; for (int i = 1; i < n; i++) cout << ' ' << a[i]; return cout; }
//重载set<t1>输出
template<class T1> ostream& operator<<(ostream& cout, set<T1> a) { int n = a.size(); if (!n) return cout; for (auto it : a) cout << it << ' '; return cout; }

#define all(x) (x).begin(),(x).end()
#define vi vector<int>
#define vpi vector<pair<ll, ll>>
#define why cerr<<"enter\n"

using ll = long long;
using pii = pair<ll, ll>;

constexpr ll inf = 1e18 + 10;
constexpr int N = 110;

void solve()
{
    ll n, k;
    cin >> n >> k;

    vector<pii> a(n + 1); 
    map<ll, ll> m;
    for(int i = 1; i <= n; i ++) {
        ll x, y;
        cin >> x >> y;
        m[x] += y;
        a[i] = {x, y};
    }

    ll day = a[1].first;
    ll now = 1ll * day * k;
    for(auto [x, y] : m) {
        if(x != day) now += 1ll * k * (x - day);
        if(now < y) {
            cout << "No" << endl;
            return;
        }
        now -= y;
        day = x;
    }

    cout << "Yes" << endl;

}

signed main()
{
    int T = 1;
    cin >> T;
    while(T --) solve();
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

input:

2
4 5
6 12
1 3
6 15
8 1
3 100
3 200
4 300
6 100

output:

Yes
No

result:

ok 2 token(s): yes count is 1, no count is 1

Test #2:

score: 0
Accepted
time: 3ms
memory: 3624kb

input:

100
22 5902
2156 41112
4784 2494327
2156 18332
1932 561243
7775 6411977
4325 42582
3982 5455884
7775 3752795
1932 268336
2156 43482
4325 1574341
4325 407463
2156 3547
2156 120919
8417 3789084
4784 214691
1932 4577101
7775 7488110
3982 2029754
1932 5995988
3982 3291414
2156 1094658
69 8933
6042 13932...

output:

No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
No
No
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
No
Yes
No
Yes
Yes
Yes
No
Yes
...

result:

ok 100 token(s): yes count is 62, no count is 38