#include <iostream> #include <cstdio> using namespace std; #define get getchar_unlocked int Nscan() { int n = 0, ch = 0; while (ch < '0' || ch > '9') ch = get(); while ('0' <= ch && ch <= '9') { n = (n << 3) + (n << 1) + ch - '0'; ch = get(); } return n; } int main() { std::ios_base::sync_with_stdio(false); cin.tie(NULL); int q=2, n=Nscan(), a,b,c=0; while(n--) { while(c<='0') c=get(); b=0; while(c>='0') { a=b; b=c; c=get(); } if((a==0)&&(b=='1')) if(!(--q)) break; } cout << q << "\n2\n1 2\n"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <iostream> #include <cstdio> using namespace std; #define get getchar_unlocked int Nscan() { int n = 0, ch = 0; while (ch < '0' || ch > '9') ch = get(); while ('0' <= ch && ch <= '9') { n = (n << 3) + (n << 1) + ch - '0'; ch = get(); } return n; } int main() { std::ios_base::sync_with_stdio(false); cin.tie(NULL); int q=2, n=Nscan(), a,b,c=0; while(n--) { while(c<='0') c=get(); b=0; while(c>='0') { a=b; b=c; c=get(); } if((a==0)&&(b=='1')) if(!(--q)) break; } cout << q << "\n2\n1 2\n"; return 0; } |