提出 #3297925


ソースコード 拡げる

Copy
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    string st;
    cin>>st;
    int n=st.size();
    if(st[0]=='0'||st[n-1]=='1'){
        cout<<-1<<endl;
        return 0;
    }
    int x=-1;
    FOR(i,1,n-1){
        if(st[i]=='0'&&st[n-i-2]=='1'){
            cout<<-1<<endl;
            return 0;
        }
    }
    int par=2;
    cout<<1<<" "<<2<<endl;
    FOR(i,1,n-1){
        cout<<par<<" "<<i+2<<endl;
        if(st[i]=='1'){
            par=i+2;
        }
    }
    return 0;
}

提出情報

提出日時
問題 E - Tr/ee
ユーザ SugarDragon5
言語 C++14 (GCC 5.4.1)
得点 700
コード長 1220 Byte
結果
実行時間 174 ms
メモリ 1664 KB

テストケース

セット名 得点 / 配点 テストケース
Sample 0 / 0 sample1_1111.txt, sample2_1110.txt, sample3_1010.txt
All 700 / 700 00-0.txt, 000.txt, 11-1.txt, 110.txt, bin.txt, bins.txt, fib.txt, one_0.txt, one_1.txt, one_2.txt, one_3.txt, rndNO1.txt, rndNO_0.txt, rndNO_1.txt, rndNO_2.txt, rndNO_3.txt, rndNO_4.txt, rndNO_5.txt, rndNOeven.txt, rndNOn.txt, rndNOodd.txt, rndYESeven_0.txt, rndYESeven_1.txt, rndYESeven_2.txt, rndYESeven_3.txt, rndYESeven_4.txt, rndYESeven_5.txt, rndYESeven_6.txt, rndYESeven_7.txt, rndYESeven_8.txt, rndYESeven_9.txt, rndYESodd_0.txt, rndYESodd_1.txt, rndYESodd_2.txt, rndYESodd_3.txt, rndYESodd_4.txt, rndYESodd_5.txt, rndYESodd_6.txt, rndYESodd_7.txt, rndYESodd_8.txt, rndYESodd_9.txt, sample1_1111.txt, sample2_1110.txt, sample3_1010.txt, star_0.txt, star_1.txt, star_2.txt, star_3.txt
ケース名 結果 実行時間 メモリ
00-0.txt 4 ms 512 KB
000.txt 1 ms 256 KB
11-1.txt 4 ms 512 KB
110.txt 1 ms 256 KB
bin.txt 109 ms 1152 KB
bins.txt 1 ms 256 KB
fib.txt 157 ms 1536 KB
one_0.txt 162 ms 1664 KB
one_1.txt 162 ms 1664 KB
one_2.txt 165 ms 1664 KB
one_3.txt 164 ms 1664 KB
rndNO1.txt 4 ms 512 KB
rndNO_0.txt 1 ms 256 KB
rndNO_1.txt 1 ms 256 KB
rndNO_2.txt 1 ms 256 KB
rndNO_3.txt 1 ms 256 KB
rndNO_4.txt 1 ms 256 KB
rndNO_5.txt 1 ms 256 KB
rndNOeven.txt 3 ms 384 KB
rndNOn.txt 4 ms 512 KB
rndNOodd.txt 5 ms 512 KB
rndYESeven_0.txt 2 ms 256 KB
rndYESeven_1.txt 3 ms 256 KB
rndYESeven_2.txt 6 ms 256 KB
rndYESeven_3.txt 1 ms 256 KB
rndYESeven_4.txt 12 ms 256 KB
rndYESeven_5.txt 50 ms 640 KB
rndYESeven_6.txt 1 ms 256 KB
rndYESeven_7.txt 2 ms 256 KB
rndYESeven_8.txt 1 ms 256 KB
rndYESeven_9.txt 2 ms 256 KB
rndYESodd_0.txt 1 ms 256 KB
rndYESodd_1.txt 58 ms 768 KB
rndYESodd_2.txt 4 ms 256 KB
rndYESodd_3.txt 1 ms 256 KB
rndYESodd_4.txt 1 ms 256 KB
rndYESodd_5.txt 1 ms 256 KB
rndYESodd_6.txt 3 ms 256 KB
rndYESodd_7.txt 22 ms 384 KB
rndYESodd_8.txt 2 ms 256 KB
rndYESodd_9.txt 1 ms 256 KB
sample1_1111.txt 1 ms 256 KB
sample2_1110.txt 1 ms 256 KB
sample3_1010.txt 1 ms 256 KB
star_0.txt 161 ms 1280 KB
star_1.txt 163 ms 1280 KB
star_2.txt 164 ms 1280 KB
star_3.txt 174 ms 1280 KB