QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189622#5471. Interactive Number GuessingGenshinImpactsFault#TL 0ms0kbC++171.1kb2023-09-27 18:38:072023-09-27 18:38:07

Judging History

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

  • [2023-09-27 18:38:07]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2023-09-27 18:38:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int p;
struct Node{
    int l, r, id;
} a[1010];
int cnt[1010], Ans[1010], ban[1010];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, K;
    cin >> n >> K;
    for(int i = 1; i <= n; ++ i) {
        cin >> a[i].l >> a[i].r;
        a[i].id = i;
    }
    p = 1;
    for(int i = 1; i <= 31; ++ i) {
        for(int j = 1; j <= K; ++ j) {
            int pos = -1;
            for(int k = 1; k <= n; ++ k) {
                if(!ban[k]) {
                    if(a[k].l <= i && i <= a[k].r) {
                        if(pos == -1) {
                            pos = k;
                        }
                        else {
                            if(a[k].r < a[pos].r) {
                                pos = k;
                            }
                        }
                    }
                }
            }
            if(pos != -1) {
                ban[pos] = 1;
                Ans[a[pos].id] = i;
            }
        }
    }
    for(int i = 1; i <= n; ++ i) {
        cout << Ans[i] << "\n";
    }
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:


output:


result: