QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#389023 | #6703. Tokens on the Segments | Mayuri | WA | 77ms | 5240kb | C++14 | 2.5kb | 2024-04-13 23:42:34 | 2024-04-13 23:42:35 |
Judging History
answer
//#define _CRT_SECURE_NO_WARNINGS
//#include<bits/stdc++.h>
//using namespace std;
//typedef long long ll;
//typedef long double ld;
//#define endl '\n'
//const ll maxn = 2e5 + 5;
//ll T;
//ll n, m, k;
//ll u[maxn], v[maxn];
//
//int main()//D
//{
// ios::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
// cin >> T;
// while (T--) {
// cin >> k;
// string s; cin >> s;
// cin >> n >> m;
// for (ll i = 1; i <= m; i++) {
// ll u, v; cin >> u >> v;
// }
// ll d = m - n + 2;
// d--;
// ll t = d % k;
// if (s[t] == '1') cout << 2 << endl;
// else cout << 1 << endl;
// }
//}
//#define _CRT_SECURE_NO_WARNINGS
//#include<bits/stdc++.h>
//using namespace std;
//typedef long long ll;
//typedef long double ld;
//#define endl '\n'
//const ll maxn = 2e5 + 5;
//ll T;
//ll n, m, k;
//ll u[maxn], v[maxn];
//ll dx[4] = { -1, 0, 1, 0 }, dy[4] = { 0, 1, 0, -1 };
//ll f(char ch) {
// if (ch == 'U')return 0;
// if (ch == 'R')return 1;
// if (ch == 'D')return 2;
// if (ch == 'L')return 3;
//}
//int main()//C
//{
// ios::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
// cin >> T;
// while (T--) {
// cin >> n >> k;
// string s; cin >> s;
// ll bx = 0, by = 0;
// ll mx = 0, my = 0;
// ll mmax = 0;
// for (ll i = 0; i < s.size(); i++) {
// ll t = f(s[i]);
// bx += dx[t];
// by += dy[t];
// if (abs(bx) + abs(by) > abs(mx) + abs(my)) {
// mx = bx;
// my = by;
// }
// }
// bx = bx * (k - 1);
// by = by * (k - 1);
// ll tx = 0, ty = 0;
// for (ll i = 0; i < s.size(); i++) {
// ll t = f(s[i]);
// bx += dx[t];
// by += dy[t];
// if (abs(bx) + abs(by) > abs(tx) + abs(ty)) {
// tx = bx;
// ty = by;
// }
// }
// cout << max(abs(tx) + abs(ty), abs(mx) + abs(my)) << endl;
// }
//}
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define endl '\n'
const ll maxn = 2e5 + 5;
ll T;
ll n, m;
struct node {
ll l, r;
bool operator<(node t)const {
if (r == t.r) return l < t.l;
return r < t.r;
}
}N[maxn];
int main()//C
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> T;
while (T--) {
cin >> n;
for (ll i = 1; i <= n; i++) cin >> N[i].l >> N[i].r;
sort(N + 1, N + 1 + n);
ll cur = 1;
ll ans = 0;
for (ll i = 1; i <= n; i++) {
if (cur > N[i].r)continue;
cur++;
cur = max(cur, N[i].l);
ans++;
}
cout << ans << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3604kb
input:
2 3 1 2 1 1 2 3 3 1 2 1 1 2 2
output:
3 2
result:
ok 2 number(s): "3 2"
Test #2:
score: -100
Wrong Answer
time: 77ms
memory: 5240kb
input:
10000 6 5 19 7 12 10 10 4 14 1 12 5 11 7 3 5 1 10 12 15 2 13 8 11 5 20 11 14 18 6 17 6 9 6 20 2 7 1 11 16 19 2 5 1 14 5 8 14 19 4 7 11 19 11 13 2 9 3 12 12 13 19 19 13 16 11 11 13 1 2 14 17 15 16 12 17 15 17 6 7 8 11 12 19 3 8 10 19 18 6 9 16 18 13 15 14 15 9 13 2 8 12 18 8 16 16 18 3 18 1 12 4 13 1...
output:
6 7 18 11 15 12 8 16 15 3 4 5 9 17 14 17 16 13 8 16 15 17 11 15 11 12 4 13 13 3 5 14 9 3 16 8 8 15 7 16 4 11 18 18 6 13 13 12 19 10 6 6 11 7 13 12 16 3 16 13 13 14 7 6 6 11 13 13 3 5 3 4 10 6 3 7 14 14 12 4 9 8 15 16 10 11 10 8 4 12 18 8 16 10 15 16 13 11 6 13 15 16 10 6 8 8 9 14 8 13 14 15 13 16 14...
result:
wrong answer 5th numbers differ - expected: '18', found: '15'