QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671332 | #6691. Orders | Schoolbag | AC ✓ | 2ms | 3596kb | C++20 | 1.2kb | 2024-10-24 12:04:02 | 2024-10-24 12:04:04 |
Judging History
answer
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef map<int, int> mii;
typedef unordered_map<int, int> umii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vc;
typedef vector<long long> vl;
typedef vector<vector<long long>> vll;
typedef __int128_t int128;
#define rep(x, y, z) for(int x = (y); x <= (z); x++)
#define per(x, y ,z) for(int x = (y); x >= (z); x--)
#define yes cout << "Yes\n"
#define no cout << "No\n"
//#define int long long
//const int N = 1e5 + 5;
//const int mod = 1e9 + 7;
//const ll inf = 1e18;
void solve(){
ll n, k; cin >> n >> k;
vector<pll> p(n + 1, {0, 0});
rep(i, 1, n) cin >> p[i].first >> p[i].second;
sort(p.begin() + 1, p.end());
ll now = 0;
rep(i, 1, n){
now += (p[i].first - p[i-1].first)*k;
if(now < p[i].second){
no;
return;
}
else{
now -= p[i].second;
}
}
yes;
}
signed main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int __ = 1; cin >> __;
while(__--){
solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
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: 2ms
memory: 3596kb
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