QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#389021 | #6703. Tokens on the Segments | Mayuri | WA | 0ms | 3736kb | C++14 | 2.4kb | 2024-04-13 23:39:22 | 2024-04-13 23:39:23 |
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 {
return l < t.l;
}
}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;
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3736kb
input:
2 3 1 2 1 1 2 3 3 1 2 1 1 2 2
output:
2 2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'