Submission #3309244


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \    | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/





string S;
int N;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> S;
    N = S.length();

    if (S.front() == '0' or S.back() == '1') {
        printf("-1\n");
        return;
    }

    rep(i, 0, (N - 1) / 2) if (S[i] != S[N - 2 - i]) {
        printf("-1\n");
        return;
    }

    vector<pair<int, int>> ans;
    int top = 0;
    rep(i, 0, N - 1) {
        ans.push_back({ top, i + 1 });

        if (S[i] == '1') top = i + 1;
    }

    fore(p, ans) printf("%d %d\n", p.first + 1, p.second + 1);
}

Submission Info

Submission Time
Task E - Tr/ee
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 700
Code Size 1863 Byte
Status
Exec Time 18 ms
Memory 2372 KB

Test Cases

Set Name Score / Max Score Test Cases
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
Case Name Status Exec Time Memory
00-0.txt 2 ms 512 KB
000.txt 2 ms 256 KB
11-1.txt 2 ms 512 KB
110.txt 2 ms 256 KB
bin.txt 12 ms 1784 KB
bins.txt 2 ms 256 KB
fib.txt 17 ms 2292 KB
one_0.txt 18 ms 2372 KB
one_1.txt 17 ms 2372 KB
one_2.txt 17 ms 2372 KB
one_3.txt 17 ms 2372 KB
rndNO1.txt 2 ms 384 KB
rndNO_0.txt 2 ms 256 KB
rndNO_1.txt 1 ms 256 KB
rndNO_2.txt 2 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 2 ms 384 KB
rndNOn.txt 2 ms 384 KB
rndNOodd.txt 2 ms 384 KB
rndYESeven_0.txt 2 ms 256 KB
rndYESeven_1.txt 2 ms 256 KB
rndYESeven_2.txt 2 ms 384 KB
rndYESeven_3.txt 2 ms 256 KB
rndYESeven_4.txt 3 ms 512 KB
rndYESeven_5.txt 6 ms 1056 KB
rndYESeven_6.txt 1 ms 256 KB
rndYESeven_7.txt 1 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 7 ms 1180 KB
rndYESodd_2.txt 2 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 2 ms 256 KB
rndYESodd_7.txt 4 ms 640 KB
rndYESodd_8.txt 2 ms 256 KB
rndYESodd_9.txt 2 ms 256 KB
sample1_1111.txt 1 ms 256 KB
sample2_1110.txt 1 ms 256 KB
sample3_1010.txt 2 ms 256 KB
star_0.txt 17 ms 1988 KB
star_1.txt 17 ms 1988 KB
star_2.txt 17 ms 1988 KB
star_3.txt 17 ms 2116 KB