結果

問題 No.5004 Room Assignment
ユーザー kaede2020kaede2020
提出日時 2021-12-02 06:45:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 150 ms / 5,000 ms
コード長 3,020 bytes
コンパイル時間 4,198 ms
実行使用メモリ 22,392 KB
スコア 2,774,712
平均クエリ数 7650.00
最終ジャッジ日時 2021-12-02 06:45:48
合計ジャッジ時間 23,629 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
21,896 KB
testcase_01 AC 130 ms
21,924 KB
testcase_02 AC 130 ms
21,912 KB
testcase_03 AC 130 ms
21,924 KB
testcase_04 AC 130 ms
21,792 KB
testcase_05 AC 131 ms
22,104 KB
testcase_06 AC 131 ms
21,912 KB
testcase_07 AC 130 ms
22,028 KB
testcase_08 AC 144 ms
21,936 KB
testcase_09 AC 131 ms
22,032 KB
testcase_10 AC 132 ms
21,924 KB
testcase_11 AC 131 ms
22,092 KB
testcase_12 AC 130 ms
22,080 KB
testcase_13 AC 131 ms
22,140 KB
testcase_14 AC 130 ms
21,888 KB
testcase_15 AC 130 ms
21,828 KB
testcase_16 AC 130 ms
21,924 KB
testcase_17 AC 142 ms
21,948 KB
testcase_18 AC 132 ms
21,936 KB
testcase_19 AC 131 ms
22,112 KB
testcase_20 AC 131 ms
22,092 KB
testcase_21 AC 130 ms
21,780 KB
testcase_22 AC 131 ms
21,780 KB
testcase_23 AC 132 ms
22,220 KB
testcase_24 AC 131 ms
21,780 KB
testcase_25 AC 131 ms
21,948 KB
testcase_26 AC 142 ms
21,768 KB
testcase_27 AC 139 ms
21,888 KB
testcase_28 AC 133 ms
22,152 KB
testcase_29 AC 132 ms
21,948 KB
testcase_30 AC 130 ms
22,032 KB
testcase_31 AC 130 ms
22,212 KB
testcase_32 AC 133 ms
21,948 KB
testcase_33 AC 132 ms
22,104 KB
testcase_34 AC 132 ms
21,960 KB
testcase_35 AC 140 ms
22,392 KB
testcase_36 AC 138 ms
21,972 KB
testcase_37 AC 135 ms
22,368 KB
testcase_38 AC 133 ms
21,912 KB
testcase_39 AC 131 ms
21,960 KB
testcase_40 AC 133 ms
21,780 KB
testcase_41 AC 131 ms
21,936 KB
testcase_42 AC 132 ms
22,104 KB
testcase_43 AC 133 ms
21,948 KB
testcase_44 AC 142 ms
21,960 KB
testcase_45 AC 141 ms
22,128 KB
testcase_46 AC 132 ms
22,020 KB
testcase_47 AC 132 ms
21,948 KB
testcase_48 AC 132 ms
21,912 KB
testcase_49 AC 133 ms
21,768 KB
testcase_50 AC 131 ms
22,116 KB
testcase_51 AC 133 ms
22,116 KB
testcase_52 AC 132 ms
21,780 KB
testcase_53 AC 140 ms
22,140 KB
testcase_54 AC 138 ms
21,972 KB
testcase_55 AC 131 ms
21,900 KB
testcase_56 AC 131 ms
21,924 KB
testcase_57 AC 140 ms
22,344 KB
testcase_58 AC 134 ms
21,948 KB
testcase_59 AC 130 ms
21,948 KB
testcase_60 AC 132 ms
21,936 KB
testcase_61 AC 133 ms
21,780 KB
testcase_62 AC 141 ms
22,100 KB
testcase_63 AC 142 ms
21,924 KB
testcase_64 AC 135 ms
22,212 KB
testcase_65 AC 131 ms
21,792 KB
testcase_66 AC 131 ms
22,164 KB
testcase_67 AC 133 ms
21,816 KB
testcase_68 AC 140 ms
21,924 KB
testcase_69 AC 132 ms
21,960 KB
testcase_70 AC 132 ms
21,936 KB
testcase_71 AC 139 ms
21,804 KB
testcase_72 AC 133 ms
21,948 KB
testcase_73 AC 132 ms
21,776 KB
testcase_74 AC 131 ms
21,924 KB
testcase_75 AC 132 ms
21,948 KB
testcase_76 AC 130 ms
22,032 KB
testcase_77 AC 133 ms
22,008 KB
testcase_78 AC 130 ms
21,968 KB
testcase_79 AC 131 ms
22,356 KB
testcase_80 AC 149 ms
21,972 KB
testcase_81 AC 132 ms
21,936 KB
testcase_82 AC 132 ms
22,104 KB
testcase_83 AC 131 ms
21,780 KB
testcase_84 AC 131 ms
21,900 KB
testcase_85 AC 133 ms
21,972 KB
testcase_86 AC 131 ms
21,768 KB
testcase_87 AC 130 ms
21,792 KB
testcase_88 AC 132 ms
21,780 KB
testcase_89 AC 150 ms
21,912 KB
testcase_90 AC 139 ms
21,960 KB
testcase_91 AC 131 ms
21,956 KB
testcase_92 AC 132 ms
21,984 KB
testcase_93 AC 131 ms
21,732 KB
testcase_94 AC 130 ms
21,984 KB
testcase_95 AC 132 ms
21,792 KB
testcase_96 AC 131 ms
21,936 KB
testcase_97 AC 132 ms
22,092 KB
testcase_98 AC 148 ms
21,900 KB
testcase_99 AC 139 ms
21,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//fixed,setprecision
#include <limits.n>//INT_MAX
#include <math.n>//M_PI
#include <random>
#include <regex> // 正規表現
#include <time.h>*/
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
//using mint = modint998244353;
//std::chrono::time_point<std::chrono::steady_clock> start;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
//typedef pair<int, int> P;
using vi=vector<int>;
using vvi=vector<vi>;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
template<class T, class U>
//contain(string s,string v) sにvが含まれるかを判定

bool contain(const std::basic_string<T>& s, const U& v) {
   return s.find(v) != std::basic_string<T>::npos;
}

// トポロジカルソートする
struct toposo {
    
	vector<vector<int>> E; toposo(int n) { E.resize(n); }
    
	void add_edge(int a, int b) { E[a].push_back(b); }
    
	bool visit(int v, vector<int>& order, vector<int>& seen) {
		seen[v] = 1;
        for (int u : E[v]) {
			if (seen[u] == 2) continue;
			if (seen[u] == 1) return false;
	        if (!visit(u, order, seen)) return false;
		}
		order.push_back(v);
		seen[v] = 2;
		return true;
	}
    // トポロジカルソート順
	bool sort(vector<int> &order) {
		int n = E.size();
		vector<int> seen(n);
        rep(u,n)if (!seen[u] && !visit(u, order, seen)) return false;
        reverse(order.begin(), order.end());
		return true;
	}
};

const int T=3600;
const int R=4;
int main(){
	int dammyT,dammyR;
	cin>>dammyT>>dammyR;
	int t=T;
	deque<int>g;
	int hito=0;
	int cnt=0;
	while(t--){
		int n;
		cin>>n;
		rep(i,n){
			int s;
			cin>>s;
			hito++;
			g.push_back(hito);
		}
		int m=0;
		vector<pair<int,int>>ans;
		while(g.size()>1){
			if(cnt<=2){
				int x=g.front();g.pop_front();
				int y=g.front();g.pop_front();
				ans.emplace_back(x,y);
				m++;
				cnt++;
				g.push_front(x);
			}else{
				g.front();g.pop_front();
				cnt=0;
			}
		}
		cout<<m<<endl;
		if(m!=0){
			rep(i,m){
				cout<<ans[i].first<<" "<<ans[i].second<<endl;
			}
		}
	}
	return 0;
}
0