結果

問題 No.1149 色塗りゲーム
ユーザー 沙耶花沙耶花
提出日時 2020-08-07 21:31:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 2,508 ms
コンパイル使用メモリ 191,928 KB
最終ジャッジ日時 2025-01-12 15:52:01
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000001

int main(){
	
	int N;
	cin>>N;
	
	if(N%2==0){
		cout<<2<<' '<<N/2<<endl;
	}
	else{
		cout<<1<<' '<<N/2+1<<endl;
	}
	
	
	while(true){
		int t;
		cin>>t;
		if(t<3)break;
		int k,x;
		cin>>k>>x;
		cout<<k<<' ';
		int X;
		if(N%2==1){
			X = (N/2)+1 + (N/2+1 - x);
		}
		else{
			if(x<N/2){
				X = N/2+1 + (N/2-x);
			}
			else{
				X = N/2 - (x-(N/2+1));
			}
		}
		if(k==2){
			X--;
		}
		cout<<X<<endl;
	}
	
	return 0;
}
0