QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#711718 | #4393. Snatch Groceries | hejinming983282# | WA | 31ms | 5900kb | C++23 | 1.4kb | 2024-11-05 13:10:05 | 2024-11-05 13:10:06 |
Judging History
answer
// Author : hejinming2012
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define dbg(x) cout << #x " = " << (x) << endl
#define quickio ios::sync_with_stdio(false);
#define quickin cin.tie(0);
#define quickout cout.tie(0);
using namespace std;
inline int read() {
int now = 0, nev = 1; char c = getchar();
while(c < '0' || c > '9') { if(c == '-') nev = -1; c = getchar(); }
while(c >= '0' && c <= '9') { now = (now << 1) + (now << 3) + (c & 15); c = getchar(); }
return now * nev;
}
void write(int x) {
if(x < 0) putchar('-'), x = -x;
if(x > 9) write(x / 10);
putchar(x % 10 + '0');
}
struct node {
int e, l, qs;
};
bool cmp(node w, node s) {
if(w.e == s.e) {
if(w.l == s.l) return w.qs < s.qs;
return w.l > s.l;
}
return w.e < s.e;
}
signed main() {
quickio
quickin
quickout
int T = read();
while(T--) {
int n = read();
vector <node> q(n);
for(int i = 0; i < n; i++)
q[i].e = read(), q[i].l = read(), q[i].qs = i;
sort(q.begin(), q.end(), cmp);
int sum = 0, f = 0;
for(int i = 0; i < n; i++) {
if(q[i + 1].e <= q[i].l && i < n)
{ f = 1; break ; }
if(!f) sum++;
}
if(n == 1) sum = 1;
write(sum), putchar(10);
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 31ms
memory: 5900kb
input:
5 3 1 2 3 4 5 6 3 1 2 3 4 4 5 100000 263324740 263324748 920719069 920719077 82595123 82595132 765796214 765796222 621714954 621714959 77799324 77799332 278166427 278166428 375391536 375391545 856576804 856576812 512542774 512542781 829984452 829984457 302442403 302442404 779239984 779239986 1189173...
output:
3 1 275 5575 9999
result:
wrong answer 5th lines differ - expected: '10000', found: '9999'