Submission #3296808


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;


#define pb push_back
#define fo(i, n) for(int i = 1; i <= n; ++i)

const int mod = 1e9 + 7;
const int N = 700012;
const int inf = 2e9;
typedef long long ll;
int n;
map<int, int> cnt1, cnt2;
int a[N];
vector<int> g[N];
inline bool cmp(pair<int,int> a, pair<int,int> b) {
    if(a.second!=b.second) return a.second>b.second;
    return a.first<b.first;
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    int n = s.length();
    s='#'+s;
    if(s[n]=='1') return cout << -1, 0;
    if(s[1]=='0') return cout << -1, 0;
    for(int i=1;i<n;++i)
        if(s[i]!=s[n-i]) return cout << -1, 0;
    int cur=1;
    vector<pair<int, int> > e;
    bool not_add = 0;
    for(int i=2;i<=n;++i) {
        e.pb({i, cur});
        if(s[i-1] == '1')
            cur = i;
    }
    for(auto &x: e) cout << x.first << ' ' << x.second << '\n';
    return 0;
}

Submission Info

Submission Time
Task E - Tr/ee
User Speedster
Language C++14 (GCC 5.4.1)
Score 700
Code Size 965 Byte
Status
Exec Time 24 ms
Memory 20852 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 7 ms 18944 KB
000.txt 7 ms 18688 KB
11-1.txt 7 ms 18944 KB
110.txt 7 ms 18688 KB
bin.txt 18 ms 20088 KB
bins.txt 7 ms 18688 KB
fib.txt 24 ms 20852 KB
one_0.txt 23 ms 20836 KB
one_1.txt 23 ms 20836 KB
one_2.txt 23 ms 20836 KB
one_3.txt 23 ms 20836 KB
rndNO1.txt 7 ms 18944 KB
rndNO_0.txt 7 ms 18688 KB
rndNO_1.txt 7 ms 18688 KB
rndNO_2.txt 7 ms 18688 KB
rndNO_3.txt 7 ms 18688 KB
rndNO_4.txt 7 ms 18688 KB
rndNO_5.txt 7 ms 18688 KB
rndNOeven.txt 7 ms 18816 KB
rndNOn.txt 7 ms 18816 KB
rndNOodd.txt 7 ms 18944 KB
rndYESeven_0.txt 7 ms 18688 KB
rndYESeven_1.txt 7 ms 18688 KB
rndYESeven_2.txt 7 ms 18816 KB
rndYESeven_3.txt 7 ms 18688 KB
rndYESeven_4.txt 8 ms 18944 KB
rndYESeven_5.txt 12 ms 19456 KB
rndYESeven_6.txt 7 ms 18688 KB
rndYESeven_7.txt 7 ms 18688 KB
rndYESeven_8.txt 7 ms 18688 KB
rndYESeven_9.txt 7 ms 18688 KB
rndYESodd_0.txt 7 ms 18688 KB
rndYESodd_1.txt 13 ms 19644 KB
rndYESodd_2.txt 7 ms 18688 KB
rndYESodd_3.txt 7 ms 18688 KB
rndYESodd_4.txt 7 ms 18688 KB
rndYESodd_5.txt 7 ms 18688 KB
rndYESodd_6.txt 7 ms 18688 KB
rndYESodd_7.txt 9 ms 19072 KB
rndYESodd_8.txt 7 ms 18688 KB
rndYESodd_9.txt 7 ms 18688 KB
sample1_1111.txt 7 ms 18688 KB
sample2_1110.txt 7 ms 18688 KB
sample3_1010.txt 7 ms 18688 KB
star_0.txt 22 ms 20452 KB
star_1.txt 22 ms 20452 KB
star_2.txt 22 ms 20452 KB
star_3.txt 23 ms 20580 KB