結果
| 問題 | No.1820 NandShift | 
| コンテスト | |
| ユーザー |  蜜蜂 | 
| 提出日時 | 2022-01-21 22:59:32 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 2,244 bytes | 
| コンパイル時間 | 3,704 ms | 
| コンパイル使用メモリ | 232,116 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-26 02:15:50 | 
| 合計ジャッジ時間 | 4,560 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 2 | 
| other | WA * 30 | 
ソースコード
//g++ 1.cpp -std=c++14 -O2 -I .
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;
#define fi first
#define se second
#define pb push_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())
vi query;
int op=0;
void op1(int x,int i){
  //cout<<"1 "<<x<<" "<<i<<endl;
  op++;
  query.emplace_back(1);
  query.emplace_back(x);
  query.emplace_back(i);
}
void op2(int x,int i,int j){
  //cout<<"1 "<<x<<" "<<i<<" "<<j<<endl;
  op++;
  query.emplace_back(2);
  query.emplace_back(x);
  query.emplace_back(i);
  query.emplace_back(j);
}
void output(){
  cout<<query.size()<<endl;
  for(int v:query){
    cout<<v<<" ";
  }
  cout<<endl;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,m;
  cin>>n>>m;
  string x;
  cin>>x;
  /*
  b[1e9]= 111...11
  b[1e9-1] = 111...10
  b[1000] = 111...11 -> 000...01
  */
  op2(1e9,0,0); // b[1e9]= 111...11
  op1(1e9-1,1e9); // b[1e9-1] = 111...10
  op2(1000,0,0);
  op2(1000,1000,1e9-1); // b[1000] = 000...01
  rep(i,1,m){
    op1(1000+i,1000+i-1);
  }
  // b[1000] = 000...01
  // b[1001] = 000...10
  // b[1000+M-1] = 100...00
  rep(i,0,m){
    op2(2000+i,2000+i,1e9);
    op2(2000+i,2000+i,1000+i);
  }
  // b[2000] = 111...10
  // b[2001] = 111...01
  // b[2000+M-1] = 011...11
  op2(0,0,0); // b[0] = 111...11
  string tar="";
  rep(i,0,m){
    if(x[i]=='0'){
      tar+='1';
    }
    else{
      tar+='0';
    }
  }
  // tarを作ろう
  rep(i,0,m){
    if(tar[i]=='0'){
      rep(j,i+1,m){
        if(tar[j]=='0'){
          op2(2000+i,2000+i,2000+j);
          op2(2000+i,2000+i,1e9);
        }
      }
      op2(0,0,2000+i);
      output();
      return 0;
    }
  }
  output();
  return 0;
}
            
            
            
        