CF Avengers Federation Field ...
Water Problem A-hulk (Hulk)
Output Love hate ...
#include <bits/stdc++.h>typedef long long ll;const int n = 1e5 + 5;int main () { int n; scanf ("%d", &n); printf ("I hate"); for (int i=1, i<n; ++i) { if (I & 1) printf ("That's Love"); else printf ("that I hate"); } Puts ("it"); return 0;}
Game + Play table to find the Law B-spider Man (Spiderman)
Notice that each time more than one lap, the previous or initial state, the groups are independent, so to play a table or analysis can find the law.
#include <bits/stdc++.h>typedef long long ll;const int N = 1e5 + 5;int a[n];int sg[105];int sg (int x) { if (x &L T 2) return sg[x] = 0; BOOL vis[105]; Memset (Vis, false, sizeof (VIS)); for (int i=1; i<x; ++i) { vis[sg (i) ^ (SG (x-i))] = true; } int &ret = Sg[x] = 0; while (Vis[ret]) ret++; return ret;} void Test () { memset (SG,-1, sizeof (SG)); for (int i=1; i<=20; ++i) { printf ("sg[%d]=%d\n", I, SG (i));} } int main () { //test (); int n; scanf ("%d", &n); for (int i=1; i<=n; ++i) scanf ("%d", a+i); int ans = 0; for (int i=1; i<=n; ++i) { int res = a[i] & 1? 0:1; Ans ^= Res; printf ("%d\n", ans? 1:2); } return 0;}
Construction C-thor (Thor)
Test instructions: A mobile phone has n applications, there are three kinds of operations:
1. The first X application has an unread message;
2. Read all unread information for the current x application;
3. Read the first T message (information may be reread);
The number of bars for which the current unread information is output after each operation.
Idea: The 3rd operation "First T" is critical, so as long as the Max (T) operation. If the information to be read is read at a later point in time (the 2nd operation) then it is not updated, so maintain the latest "empty" app number and time. Before there was a place to write the continue, the answer did not output, WA for a long time.
#include <bits/stdc++.h>typedef long long ll;const int N = 3e5 + 5;int cnt[n];int clear_time[n];std::p air<int, in t> Que[n];int Main () {int N, q; scanf ("%d%d", &n, &q); int m = 0, ans = 0; int TP, X, T, maxt = 0; for (int i=1; i<=q; ++i) {scanf ("%d", &TP); if (tp = = 1 | | tp = = 2) {scanf ("%d", &x); if (tp = = 1) {cnt[x]++; ans++; Que[++m] = {x, i}; } else {ans-= cnt[x]; Cnt[x] = 0; CLEAR_TIME[X] = i; }} else {scanf ("%d", &t); if (T > Maxt) {for (int j=maxt+1; j<=t; ++j) {int pos = Que[j].first, Tim = que[ J].second; if (Clear_time[pos] >= Tim) continue; cnt[pos]--; ans--; } maxt = t; }} printf ("%d\n", ans); } return 0;}
Codeforces Round #366 (Div. 2)