#includeusing namespace std; #define ll long long const int mo = 1e3; const int N = 1e5+5; int main() { ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); int a,b,c,d; cin>>a>>b>>c>>d; int kk=max(a,c); int tt=min(b,d); if(kk B - Tournament Result #includeC - NewFolder(1)using namespace std; #define ll long long const int mo = 1e3; const int N = 1010; char a[N][N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> a[i][j]; } } for (int i = 1; i <= n; i++) { for (int j = i+1; j <= n; j++) { int k=a[j][i]; char gg; if(k=='W')gg='L'; else if(k=='L')gg='W'; else gg='D'; if (a[i][j]!=gg) { cout<<"incorrect"; return 0; } } } cout<<"correct"; return 0; } #includeusing namespace std; #define ll long long const int mo = 1e3; const int N = 2e5 + 5; map mp; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; string s; while (t--) { cin >> s; map ::iterator it= mp.find(s); if (it != mp.end()) { mp[s]++; cout< D - Flipping and Bonus#includeE - Many Operationsusing namespace std; #define ll long long const int mo = 1e3; const int N = 5000 + 5; ll f[N][N], a[N], b[N]; //f[i][j]表示前i个硬币,当前是连续第i次,所能得到的最大价值 int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); memset(f,0,sizeof(0)); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; } int c, y; for (int i = 1; i <= m; i++) { cin >> c >> y; b[c] = y; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { f[i][j] = max(f[i - 1][j - 1] + a[i] + b[j], f[i][j]); f[i+1][0] = max(f[i][j], f[i+1][0]); //cout << i << ' ' << j << ' ' << f[i][j] << endl; } } ll ans = 0; for (int j = 1; j <= n; j++) { ans = max(f[n][j], ans); } cout << ans; return 0; } 输入是一个一个操作输入的,但我们可以全部输入完之后按位处理。最后统一输出
#includeusing namespace std; #define bit(x,i)(((x)>>(i))&1) int main(){ int n,c; cin >> n >> c; vector >op(n); for(int i=0;i > op[i].first >> op[i].second; vector ans(n); for(int k=0;k<30;k++){ array func={0,1}; int crr=bit(c,k); for(int i=0;i f; int x=bit(op[i].second,k); if(op[i].first==1)f={0&x,1&x}; if(op[i].first==2)f={0|x,1|x}; if(op[i].first==3)f={0^x,1^x}; func={f[func[0]],f[func[1]]}; crr=func[crr]; ans[i]|=crr<



