QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#775248#9730. Elevator IIhaomiao000WA 133ms3656kbC++141.2kb2024-11-23 15:10:322024-11-23 15:10:32

Judging History

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

  • [2024-11-23 15:10:32]
  • 评测
  • 测评结果:WA
  • 用时:133ms
  • 内存:3656kb
  • [2024-11-23 15:10:32]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
struct Man {
    int st;
    int ed;
    int tag;
    bool operator < (const Man b) const {
        return st < b.st;
    }
    Man(int x , int y , int z) {
        st = x;
        ed = y;
        tag = z;
    }
};
set<Man>st;

signed main() {
    int t;
    cin >> t;
    while(t --) {
        st.clear();
        int n , f;
        cin >> n >> f;
        for(int i = 1; i <= n; i ++) {
            int s , e;
            cin >> s >> e;
            st.insert(Man(s , e , i));
        }      
        int ans = 0;
        auto now = Man(f , 0 , 0);
        vector<int>cnt;
        while(!st.empty()) {
            auto it = st.lower_bound(now);
            if(it == st.end()) {
                now = *st.begin();
                it = st.begin();
            }else {
                ans += it->st - now.st;
            }
            cnt.push_back(it->tag);
            ans += it->ed - it->st;
            now.st = it->ed;
            st.erase(it);
        }
        cout << ans << endl;
        for(auto it : cnt) cout << it << " ";
        cout << endl;
        
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

2
4 2
3 6
1 3
2 7
5 6
2 5
2 4
6 8

output:

11
3 2 1 4 
5
2 1 

result:

ok ok 2 cases (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 133ms
memory: 3656kb

input:

6100
19 52
51 98
2 83
40 58
96 99
39 55
72 94
15 17
4 15
48 99
2 99
77 78
35 77
44 62
79 81
30 31
1 48
48 76
68 99
60 66
6 19
44 53
64 92
17 28
67 98
9 99
40 65
16 27
99 100
15 56
4 6
24 97
84 96
47 49
37 38
77 79
13 40
13 92
71 100
47 93
90 91
72 81
15 48
32 71
19 17
95 99
10 23
18 100
90 93
52 92
...

output:

457
19 18 16 9 2 4 8 7 15 12 11 14 5 6 3 13 1 
244
6 4 5 3 1 2 
319
16 11 3 9 6 14 5 1 2 8 13 4 7 
578
7 17 1 2 14 8 9 16 3 6 13 4 19 10 12 5 
298
11 2 7 3 12 8 13 15 1 10 9 5 6 4 
446
12 11 17 3 16 4 18 19 13 1 14 10 9 5 7 8 2 6 
123
2 3 4 1 
228
1 7 3 10 9 6 2 8 4 5 
146
1 4 6 2 5 3 
92
1 2 
56
2 ...

result:

wrong answer Integer parameter [name=a_i] equals to 244, violates the range [1, 19] (test case 1)