QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#283152 | #6691. Orders | Onlyfans | AC ✓ | 1ms | 3876kb | C++20 | 2.1kb | 2023-12-13 22:00:30 | 2023-12-13 22:00:30 |
Judging History
answer
//ADGIL
//-- Chivalrous
#include<bits/stdc++.h>
// #pragma GCC optimize("Ofast,no-stack-protector", 3)
#define endl '\n'
#define int long long
#define NO cout << "NO" << endl
#define YES cout << "YES" << endl
#define No cout << "No" << endl
#define Yes cout << "Yes" << endl
#define PII pair<int,int>
#define PIII pair<pair<int,int> , int>
#define x first
#define y second
#define pb push_back
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define SOLVE int T;cin >> T;while(T--) SV()
#define in insert
using namespace std;
int gcd(int a, int b) {if (b == 0) {return a;}return gcd(b, a % b);}
int lcm(int a, int b) {return a * b / gcd(a, b);}
int ksm(int a, int b, int p) {int res = 1;while(b){if(b & 1)res = res * a % p;b >>= 1;a = a * a % p;}return res;}
bool is_prime(int x){if(x < 2) return false; if(x == 2)return true;for(int i = 2; i * i <= x; i ++) if(x % i == 0)return false;return true;}
//ksm(a , p - 2, p);!(a % p) -> ok;
void SV() {
map<int,int> mp;
int n , k;
cin >> n >> k;
for(int i = 1; i <= n; i ++) {
int x , y;
cin >> x >> y;
mp[x] += y;
}
int pre = 0;
int res = 0;
for(auto [i , j] : mp) {
if(pre == 0) {
pre = i;
res += i * k;
res -= j;
}
else {
res += (i - pre) * k;
pre = i;
res -= j;
}
if(res < 0) {
No;return;
}
}
Yes;
}
signed main(){IOS;SOLVE;}
/*
_ooOoo_
o8888888o
88" . "88
(| ^_^ |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
佛祖保佑AC,永无bug缠身
*/
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
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: 1ms
memory: 3876kb
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