Codeforces Round #534 (Div. 2)

B. Game with string
类似括号匹配,用栈。

//Author: QOEINDIEDIS
//Date: 08-15-2019
#include 
#define fill(x,c) memset(x,c,sizeof(x))
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long ll;
const long long LL_INF = (long long) 2e18 + 5;
const int SIZE = 1e6+10;
ll n;
ll a[SIZE];
int main(){
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
	/*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	*/
	string s;cin>>s;
	string ans;int cnt=0;
	for(int i=0;i

C. Grid game
tricky!

//Author: QOEINDIEDIS
//Date: 08-13-2019
#include 
#define fill(x,c) memset(x,c,sizeof(x))
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long ll;
const long long LL_INF = (long long) 2e18 + 5;
const int SIZE = 1e6+10;
ll n;
ll a[SIZE];
int main(){
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
	/*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	*/
	string s;cin>>s;
	bool zero = false,one = false;
	for(auto &c:s){
		if(c=='0'){
			if(zero){
				cout<<"1 1"<

你可能感兴趣的:(Codeforces)