Submission #1671364


Source Code Expand

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)                                                                             
#define seg_size 524288
int go[200000] = {};
int done[200000] = {};
int main() {
	int n, k;
	cin >> n >> k;
	vector<pair<int, int>> wow;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		wow.push_back(make_pair(tmp, i));
	}
	sort(wow.begin(), wow.end());
	for (int i = 0;i < wow.size();++i) {
		go[wow[i].second] = i;
	}
	int hoge = k-1;
	vector<int> answers;
	answers.push_back(wow[hoge].second);
	for (int i = n - 1;i >= k;--i) {
		done[go[i]] = true;
		if (go[i] <= hoge) {
			while (true) {
				hoge++;
				if (done[hoge] == false) break;
			}
		}
		answers.push_back(wow[hoge].second);
	}
	REP(i, answers.size()) {
		cout << answers[answers.size() - 1 - i]+1 << endl;
	}
	return 0;
}

Submission Info

Submission Time
Task B - 特別賞
User kotamanegi
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1599 Byte
Status AC
Exec Time 190 ms
Memory 3188 KB

Judge Result

Set Name Sample Subtask1 Subtask2
Score / Max Score 0 / 0 40 / 40 60 / 60
Status
AC × 2
AC × 13
AC × 22
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
Subtask1 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt
Subtask2 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask1_01.txt AC 1 ms 256 KB
subtask1_02.txt AC 1 ms 256 KB
subtask1_03.txt AC 1 ms 256 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 3 ms 256 KB
subtask1_06.txt AC 3 ms 256 KB
subtask1_07.txt AC 1 ms 256 KB
subtask1_08.txt AC 2 ms 256 KB
subtask1_09.txt AC 2 ms 256 KB
subtask1_10.txt AC 2 ms 256 KB
subtask1_11.txt AC 2 ms 256 KB
subtask2_01.txt AC 22 ms 640 KB
subtask2_02.txt AC 2 ms 256 KB
subtask2_03.txt AC 130 ms 2676 KB
subtask2_04.txt AC 190 ms 3188 KB
subtask2_05.txt AC 37 ms 1524 KB
subtask2_06.txt AC 108 ms 2420 KB
subtask2_07.txt AC 122 ms 2548 KB
subtask2_08.txt AC 127 ms 2676 KB
subtask2_09.txt AC 132 ms 2676 KB