标签:cto display int lease lap oid with ecb closed
#include <bits/stdc++.h> #define please return #define ac 0 using namespace std; using ll = long long ; bool vis[1003]; void solve() { int n,m; cin>>n>>m; if(m>=2*n)m=m%(2*n)+2*n; string s;cin>>s; while(m--) { for(int i=0;i<n;i++){ if(s[i]==‘0‘){ int cnt=0; if(i!=0&&s[i-1]==‘1‘)cnt++; if(i!=n-1&&s[i+1]==‘1‘)cnt++; if(cnt==1)vis[i]=true; } } for(int i=0;i<n;i++) if(vis[i]){ s[i]=‘1‘;vis[i]=false; } } cout<<s<<"\n"; } int main() { //ios::sync_with_stdio(false); int t=1; cin>>t; while(t--){ solve(); } please ac; }
#include <bits/stdc++.h> #define please return #define ac 0 using namespace std; using ll = long long ; struct node{ int op,i,j; }; void solve() { int n; cin>>n; vector<int>a(n+1); vector<node>ans; auto add=[&](int i,int j){ a[i]+=a[j]; ans.push_back({1,i,j}); }; auto sub=[&](int i,int j){ a[i]-=a[j]; ans.push_back({2,j,i}); }; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n;i+=2){ int j=i+1; add(i,j); sub(j,i); sub(j,i); add(i,j); sub(j,i); sub(j,i); } cout<<ans.size()<<"\n"; for(auto &t:ans){ cout<<t.op<<" "<<t.i<<" "<<t.j<<"\n"; } } int main() { //ios::sync_with_stdio(false); int t=1; cin>>t; while(t--){ solve(); } please ac; }
#include <bits/stdc++.h> #define please return #define ac 0 using namespace std; using ll = long long ; void print(vector<auto>&x){ cout<<x[0]; for(int i=1;i<x.size();i++){ cout<<"."<<x[i]; } cout<<"\n"; } void solve() { int n; cin>>n; vector<vector<int>>s; s.push_back({}); while(n--){ int x;cin>>x; if(x==1){ vector<int>v=s.back(); v.push_back(1); print(v); s.push_back(v); } else{ while(s.back().back()!=x-1)s.pop_back(); s.back().back()++; print(s.back()); } } } int main() { ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); int t=1; cin>>t; while(t--){ solve(); } please ac; }
Deltix Round, Spring 2021 (open for everyone, rated, Div. 1 + Div. 2)
标签:cto display int lease lap oid with ecb closed
原文地址:https://www.cnblogs.com/qq1415584788/p/14830168.html