QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#485323#6703. Tokens on the SegmentsInk_baiWA 0ms3592kbC++14734b2024-07-20 16:26:552024-07-20 16:26:55

Judging History

你现在查看的是最新测评结果

  • [2024-07-20 16:26:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3592kb
  • [2024-07-20 16:26:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int T;
    cin >> T;
    while (T--)
    {
        int n;
        cin >> n;
        vector<pair<int, int>> sss(n);
        for (int i = 0; i < n; ++i)
        {
            int l, r;
            cin >> l >> r;
            sss[i] = {r, l};
        }

        sort(sss.begin(), sss.end());

        int count = 0;
        int last_placed = -1;
        for (const auto& seg : sss)
        {
            int r = seg.first;
            int l = seg.second;
            if (l > last_placed)
            {
                ++count;
                last_placed = r;
            }
        }

        cout << count << endl;
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3592kb

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'