結果
| 問題 | 
                            No.1149 色塗りゲーム
                             | 
                    
| コンテスト | |
| ユーザー | 
                             poohbear
                         | 
                    
| 提出日時 | 2020-08-07 23:07:07 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,479 bytes | 
| コンパイル時間 | 2,210 ms | 
| コンパイル使用メモリ | 193,744 KB | 
| 最終ジャッジ日時 | 2025-01-12 18:00:18 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 50 | 
ソースコード
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;
//入力
ll n;
ll t;
bool done[110];
void solve(){
    int s = 0;
    int now = 0;
    rep(i,n){
        if(done[i]){
            s ^= (now-1)%3;
            now=0;
        }
        else{
            now++;
        }
    }
    s ^= (now-1)%3;
    if(s<=1){
        rep(i,n){
            if(!done[i]){
                cout << 1 <<  ' ' << i+1 << flush;
                done[i]=true;
                break;
            }
        }
    }
    if(s==2){
        rep(i,n-1){
            if(!done[i] and !done[i+1]){
                cout << 2 <<  ' ' << i+1 << flush;
                done[i]=true;
                done[i+1]=true;
                break;
            }
        }
        rep(i,n){
            if(!done[i]){
                cout << 1 << ' ' << i+1 << flush;
                done[i]=true;
                break;
            }
        }
    }
    return;
}
int main(){
    cin >> n;
    rep(i,n)done[i]=false;
    solve();
    while(cin>>t and t>=2){
        int k,x;
        cin >> k >> x;
        rep(i,k)done[x+i]=true;
        solve();
    }
    return 0;
    
}
            
            
            
        
            
poohbear