結果

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

ソースコード

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<E> v;
std::vector<P> ans;

int main(void){
	int t,r,m=0,i,n,s,j,p;
	std::cin >> t >> r;
	for(i=0; i<t; ++i){
		if(i){
			std::cout << 0 << std::endl;
		}
		std::cin >> n;
		for(j=0; j<n; ++j){
			std::cin >> s; ++m;
			v.push_back(E(P(s,i),m));
		}
	}
	std::sort(v.begin(),v.end());
	p = 1;
	for(i=1; i<m; ++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;
	}
	return 0;
}
0