結果

問題 No.5004 Room Assignment
ユーザー ransewhale
提出日時 2021-12-01 09:34:20
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,019 bytes
コンパイル時間 818 ms
実行使用メモリ 41,016 KB
スコア 0
最終ジャッジ日時 2021-12-01 09:34:34
合計ジャッジ時間 13,697 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 99
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
using P = std::pair<int, int>;
using E = std::pair<P, int>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = 998244353ll;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

std::vector<P> v,ans;

int main(void){
	int t,r,m=0,i,n,s,j,p;
	std::cin >> t >> r;
	for(i=0; i<t; ++i){
		std::cin >> n;
		for(j=0; j<n; ++j){
			std::cin >> s; ++m;
			v.push_back(P(s,m));
		}
		std::sort(v.begin(),v.end());
		p = 1;
		for(i=0; i<v.l_ength(); ++i){
			if(p == r){
				p = 1;
				continue;
			}
			ans.push_back(P(v[i-1].second,v[i].second));
		}
		std::cout << ans.l_ength() << std::endl;
		for(i=0; i<ans.l_ength(); ++i){
			std::cout << ans[i].first << " " << ans[i].second << std::endl;
		}
		v.clear(); ans.clear();
	}
	return 0;
}
0