C is FST ................
Then it drops to 600 + ....
Then... The green name is estimated ..
Sad
A. I wanna be the guy
Question: let you judge 1 ~ N does not exist ..
SB question... Open an array ..
#include <cstdio>#include <cstring>#include <cmath>#include <string>#include <iostream>#include <algorithm>#include <queue>using namespace std;#define rep(i, n) for(int i=0; i<(n); ++i)#define for1(i,a,n) for(int i=(a);i<=(n);++i)#define for2(i,a,n) for(int i=(a);i<(n);++i)#define for3(i,a,n) for(int i=(a);i>=(n);--i)#define for4(i,a,n) for(int i=(a);i>(n);--i)#define CC(i,a) memset(i,a,sizeof(i))#define read(a) a=getint()#define print(a) printf("%d", a)#define dbg(x) cout << #x << " = " << x << endl#define printarr(a, n, m) rep(aaa, n) { rep(bbb, m) cout << a[aaa][bbb]; cout << endl; }inline const int getint() { int r=0, k=1; char c=getchar(); for(; c<‘0‘||c>‘9‘; c=getchar()) if(c==‘-‘) k=-1; for(; c>=‘0‘&&c<=‘9‘; c=getchar()) r=r*10+c-‘0‘; return k*r; }inline const int max(const int &a, const int &b) { return a>b?a:b; }inline const int min(const int &a, const int &b) { return a<b?a:b; }const int N=105;int a[N], n, p, q;int main() {read(n);read(p); for1(i, 1, p) a[getint()]=1;read(q); for1(i, 1, q) a[getint()]=1;for1(i, 1, n) if(!a[i]) { puts("Oh, my keyboard!"); return 0; }puts("I become the guy.");return 0;}
B. Chat online
Question: give you p closed intervals and Q closed intervals, then give you L and R, this allows you to determine how many L-r time values meet the requirements of adding the time before and after the Q-range to the p-range.
Enumerative L ~ R, and then use the prefix to get started.
#include <cstdio>#include <cstring>#include <cmath>#include <string>#include <iostream>#include <algorithm>#include <queue>using namespace std;#define rep(i, n) for(int i=0; i<(n); ++i)#define for1(i,a,n) for(int i=(a);i<=(n);++i)#define for2(i,a,n) for(int i=(a);i<(n);++i)#define for3(i,a,n) for(int i=(a);i>=(n);--i)#define for4(i,a,n) for(int i=(a);i>(n);--i)#define CC(i,a) memset(i,a,sizeof(i))#define read(a) a=getint()#define print(a) printf("%d", a)#define dbg(x) cout << #x << " = " << x << endl#define printarr2(a, b, c) for1(t, 1, b) { for1(u, 1, c) cout << a[t][u]; cout << endl; }#define printarr1(a, b) for1(t, 0, b) cout << a[t] << ‘ ‘; cout << endlinline const int getint() { int r=0, k=1; char c=getchar(); for(; c<‘0‘||c>‘9‘; c=getchar()) if(c==‘-‘) k=-1; for(; c>=‘0‘&&c<=‘9‘; c=getchar()) r=r*10+c-‘0‘; return k*r; }inline const int max(const int &a, const int &b) { return a>b?a:b; }inline const int min(const int &a, const int &b) { return a<b?a:b; }const int N=1005;struct dat { int x, y; }a[N], b[N];int p, q, l, r, ans, vis[N+N], mx;int main() {read(p); read(q); read(l); read(r);for1(i, 1, p) read(a[i].x), read(a[i].y), mx=max(mx, a[i].y);for1(i, 1, q) read(b[i].x), read(b[i].y), mx=max(mx, b[i].y);for1(i, l, r) {CC(vis, 0);for1(j, 1, p) ++vis[a[j].x], --vis[a[j].y+1];for1(j, 1, q) ++vis[b[j].x+i], --vis[b[j].y+1+i];int sum=0;for1(k, 0, mx) {sum+=vis[k];if(sum>1) { ++ans; break; }}}print(ans);return 0;}
C.24 game
Question: give you n numbers, which are 1 ~ N, let you add two numbers each time +-X to the original set, and the last number is 24 .. And output a feasible solution ..
It is not found until the end .... You only need to perform 24 hours of 1234 or 12345... All the following values can be 0 or 1 ....
I wrote it to 1, and I was glad to see it as FST ..
(I am also going to hack someone else... Sad .. All of them are FST ..
#include <cstdio>#include <cstring>#include <cmath>#include <string>#include <iostream>#include <algorithm>#include <queue>using namespace std;#define rep(i, n) for(int i=0; i<(n); ++i)#define for1(i,a,n) for(int i=(a);i<=(n);++i)#define for2(i,a,n) for(int i=(a);i<(n);++i)#define for3(i,a,n) for(int i=(a);i>=(n);--i)#define for4(i,a,n) for(int i=(a);i>(n);--i)#define CC(i,a) memset(i,a,sizeof(i))#define read(a) a=getint()#define print(a) printf("%d", a)#define dbg(x) cout << #x << " = " << x << endl#define printarr2(a, b, c) for1(i, 1, b) { for1(j, 1, c) cout << a[i][j]; cout << endl; }#define printarr1(a, b) for1(i, 1, b) cout << a[i]; cout << endlinline const int getint() { int r=0, k=1; char c=getchar(); for(; c<‘0‘||c>‘9‘; c=getchar()) if(c==‘-‘) k=-1; for(; c>=‘0‘&&c<=‘9‘; c=getchar()) r=r*10+c-‘0‘; return k*r; }inline const int max(const int &a, const int &b) { return a>b?a:b; }inline const int min(const int &a, const int &b) { return a<b?a:b; }int n, beg=5, cnt, tot, ck;int main() {read(n);if(n<4) { puts("NO"); return 0; }puts("YES");if(n&1) beg=6;for(int i=beg; i<=n; i+=2) {printf("%d - %d = 1\n", i+1, i);++cnt;}tot+=cnt;int t=cnt/2; bool flag=cnt&1; cnt=0;for1(i, 1, t) printf("1 - 1 = 0\n"), ++cnt;tot+=cnt;if(flag) printf("1 * 1 = 1\n"), ++tot;ck=tot;for1(i, beg, n-tot-1) printf("0 + 0 = 0\n"), ++ck;if(beg==6) {if(n>5 && n-1-ck==5) printf("5 + 0 = 5\n");printf("5 * 3 = 15\n");printf("2 * 4 = 8\n");printf("15 + 8 = 23\n");printf("23 + 1 = 24\n");}else {if(n>4 && n-1-ck==4) printf("4 + 0 = 4\n");printf("1 + 2 = 3\n");printf("3 + 3 = 6\n");printf("6 * 4 = 24\n");}return 0;}
D. Two Sets
Question: give you n numbers. All the numbers are allocated to the corresponding set when the constraints are met. Determine whether there is a solution.
I think of a bipartite graph, but it seems that I don't even create a graph? (No time ...)
Then I heard that it can be simulated? The positive solution is 2sat ?... Orz
E. Hack it!
No questions ....
Codeforces round #268 (Div. 2) (slaughter)