c被fst了。。。。。。。。。。。。。。。。

然后掉到600+.。。。

然后。。。估计得绿名了。。

sad

A.I Wanna Be the Guy

题意:让你判断1~n个数哪个数没有出现。。

sb题。。。开个数组即可。。

#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

题意:给你p个闭区间和q个闭区间,然后给你l和r,让你求有多少个在l-r的时间满足 将q个区间的前后加上这个时间,与p个区间有交。

枚举l~r,然后用前缀和搞搞就行了

#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 << 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=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

题意:给你n个数,分别为1~n,让你通过每次+-×两个数,然后加入到原集合中,最后剩一个数为24。。并且输出一个可行方案。。

到后边才发现。。。。只要会做1234或12345的24即可。。。后边的那些全部可以变成0或者变成1.。。。

我是写变成1的,,然后有个地方没特判,喜闻乐见被fst了。。

(我还去hack别人。。。sad。。自己的都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 << 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; } 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

题意:给你n个数,在满足约束的条件下将所有数都分到对应的集合里。判断是否有解。

想到二分图,但是貌似我都不会建图?(没时间了。。。)

然后听说还可以模拟?正解是2sat?。。。orz

被吓cry。。。。。。。。这题用并查集。。

开两个并查集然后模拟加入,最后判断A和B集是否重合即可。。

#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
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=100015;
map<int, int> mp;
set<int> s;
int x[N], n, a, b, p[N], tot;
const int ifind(const int &x) { return x==p[x]?x:p[x]=ifind(p[x]); } int main() {
read(n); read(a); read(b);
for1(i, 1, n) {
read(x[i]);
s.insert(x[i]);
mp[x[i]]=++tot;
}
for1(i, 1, n+2) p[i]=i;
for1(i, 1, n) {
if(s.count(a-x[i])) {
p[ifind(mp[a-x[i]])]=p[ifind(mp[x[i]])];
}
else p[ifind(mp[x[i]])]=p[ifind(n+1)];
if(s.count(b-x[i])) {
p[ifind(mp[b-x[i]])]=p[ifind(mp[x[i]])];
}
else p[ifind(mp[x[i]])]=p[ifind(n+2)];
}
if(ifind(n+1)==ifind(n+2)) {
puts("NO"); return 0;
}
puts("YES");
for1(i, 1, n) printf("%d ", ifind(mp[x[i]])==ifind(n+1));
return 0;
}

E.Hack it!

没看题。。。。

Codeforces Round #268 (Div. 2) (被屠记)的更多相关文章

  1. Codeforces Round #268 (Div. 2) ABCD

    CF469 Codeforces Round #268 (Div. 2) http://codeforces.com/contest/469 开学了,时间少,水题就不写题解了,不水的题也不写这么详细了 ...

  2. Codeforces Round #268 (Div. 1) B. Two Sets 暴力

    B. Two Sets Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/B ...

  3. Codeforces Round #268 (Div. 1) A. 24 Game 构造

    A. 24 Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/A D ...

  4. 贪心+bfs 或者 并查集 Codeforces Round #268 (Div. 2) D

    http://codeforces.com/contest/469/problem/D 题目大意: 给你一个长度为n数组,给你两个集合A.B,再给你两个数字a和b.A集合中的每一个数字x都也能在a集合 ...

  5. Educational Codeforces Round 58 Div. 2 自闭记

    明明多个几秒就能场上AK了.自闭. A:签到. #include<iostream> #include<cstdio> #include<cmath> #inclu ...

  6. Codeforces Round #268 (Div. 2)

    补题解: E:只会第四种解法:也只看懂了这一种. PS:F[X+10^18]=F[X]+1;F[X]表示X的数字之和; 假设X,F[10^18+X]+F[10^18+X-1]+......F[10^1 ...

  7. Codeforces Round#402(Div.1)掉分记+题解

    哎,今天第一次打div1 感觉头脑很不清醒... 看到第一题就蒙了,想了好久,怎么乱dp,倒过来插之类的...突然发现不就是一道sb二分吗.....sb二分看了二十分钟........ 然后第二题看了 ...

  8. Codeforces Round #554 (Div. 2)自闭记

    A 签到 #include<bits/stdc++.h> using namespace std; ],t[],ans; int main() { scanf("%d%d&quo ...

  9. Codeforces Round #545 Div. 1自闭记

    A:求出该行该列各有多少个比其小的取max,该行该列各有多少个比其大的取max,加起来即可. #include<iostream> #include<cstdio> #incl ...

随机推荐

  1. 从服务端架构设计角度,深入理解大型APP架构升级

    随着智能设备普及和移动互联网发展,移动端应用逐渐成为用户新入口,重要性越来越突出.但企业一般是先有PC端应用,再推APP,APP 1.0版的功能大多从现有PC应用平移过来,没有针对移动自身特点考虑AP ...

  2. c# 句柄数不断攀升的解决方案

    句柄只是用来标识应用程序中的不同对象和同类中的不同的实例的一个数字,通常情况下,句柄值对普通用户毫无用处,但是句柄数量却可以间接反映出一个程序里产生的对象实例的多少.句柄数越多,代表程序里new 出来 ...

  3. UVa145 Gondwanaland Telecom

    Time limit: 3.000 seconds 限时:3.000秒 Problem 问题 Gondwanaland Telecom makes charges for calls accordin ...

  4. python xml.etree.ElementTree解析xml文件获取节点

    <?xml version = "1.0" encoding = "utf-8"?> <root> <body name=&quo ...

  5. Android Exception 9(requestFeature() must be called before adding content)

    08-05 17:36:12.799: W/System.err(10378): java.lang.reflect.InvocationTargetException08-05 17:36:12.7 ...

  6. 【Python 数据分析】module 'numpy' has no attribute 'array'

    安装好Numpy模块后,开始做了几个小测试都可以运行,但是当我创建numpy.py这个文件后 numpy.py import numpy y = numpy.array([[11,4,2],[2,6, ...

  7. Tomcat日志、项目中的log4j日志、e.printStackTrace()——我的日志最后到底跑哪去了?

    1.Tomcat自带日志功能,即时你的项目中有log4j也不会影响到Tomcat自己记录日志. 2.你的项目中的log4j中的日志指定打印到什么地方(控制台或者文件),便会打印到什么地方,和Tomat ...

  8. Solr 缓存配置

    http://www.blogjava.net/xiaohuzi2008/archive/2012/12/03/392376.html

  9. java基础讲解01-----简单了解一下java

    2017-4-12(晚)  闲来无事,静静把自己了解的java,好好回忆一次.如果能帮助别人也好.会不断补充 java有关的书籍真的很多,我也不过多的介绍了. 1.什么是java 2.java的语言特 ...

  10. swift向方法传数组参数的语法

    总是记不住向方法中传数组参数的语法,所以记录一下. func calculateStatistics(scores:[Int]) -> (min:Int,max:Int,sum:Int) { v ...