Fork me on GitHub

「Codeforces」 Educational Round 45 复盘

没有体验.

首先网速就很不给力 裸连ping在1000ms+,LOSS爆炸,根本打不开.

于是科学上网勉强可以打.

垃圾ER,整天卡人的小数据出出

题意不明不知道要构造的图的性质

卡我一个多小时的D,最后就改了一行代码赛后一发AC(赛时4发WA),体验极差!

掉Rating是肯定的.

shit.

:(

后来发现E原来是傻逼题

F也一眼可做的样子

mdzz我完完全全错失ELO机会

不是先把做了的丢上来吧.

A

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//my vegetable has exploded. :(
#include<bits/stdc++.h>
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define fi first
#define se second
#define int long long
using namespace std;

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
return x * f;
}

///------------------head------------------
signed main(signed argc, char *argv[]){
int n=read(),m=read(),a=read(),b=read();
if (!(n % m)) {puts("0"); return 0;}
int x1 = n % m,x2 = m - x1;
printf("%lld\n",min(x1 * b,x2 * a));
return 0;
}

/* Examples: */
/*

*/

/*

*/

B

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//my vegetable has exploded. :(
#include<bits/stdc++.h>
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define fi first
#define se second
#define int long long
using namespace std;

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
return x * f;
}
const int maxn = 2e5+10;
int n,k,a[maxn],b[maxn],c[maxn];
pair<int,int>pa[maxn];
///------------------head------------------
signed main(signed argc, char *argv[]){
n=read(),k=read();
rep(i,1,n) a[i]=read(),pa[i]=make_pair(a[i],i);
int ans = 0;
sort(pa+1,pa+n+1);
rep(i,1,n) b[i]=pa[i].fi,c[i]=pa[i].se;
rep(i,1,n) {int tof = b[i],s; s = (upper_bound(b+1,b+n+1,tof+k) - b) - 1 - (upper_bound(b+1,b+n+1,tof)-b) + 1; if (s > 0) ++ans;}
printf("%lld\n",n-ans);
return 0;
}

/* Examples: */
/*

*/

/*

*/

C

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//my vegetable has exploded. :(
#include<bits/stdc++.h>
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define fi first
#define se second
#define int long long
using namespace std;

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
return x * f;
}

const int MAXN = 3e5+10;
int n,ans = 0;
map<int,int>buc;
string a;
pair<int,int> check(string a,int l){
int lf = 0,rt = 0;
int lneed=0;
rep(i,0,l-1)
{
if (lf == 0 && a[i] == ')') {++lneed;continue;}
lf += a[i] == '(';
rt += a[i] == ')';
int x=min(lf,rt);
lf -= x; rt -= x;
}
return make_pair(lneed,lf);
}
///------------------head------------------
signed main(signed argc, char *argv[]){
int n=read();
rep(i,1,n){
int ret = 0;
cin >> a;
int l = a.length();
pair<int,int> Re = check(a,l);
if (Re.fi > 0 && Re.se > 0) continue;
if (Re.fi == 0 && Re.se == 0) ++buc[0];
else if (Re.fi != 0) ++buc[Re.fi];
else ++buc[-Re.se];
}
for (int i = 1; i <= MAXN; i++)
{
if (!buc[i] || !buc[-i]) continue;
ans += buc[i] * buc[-i];
}
ans += buc[0] * buc[0];
printf("%lld",ans);
return 0;
}

/* Examples: */
/*

*/

/*

*/

D

我挂张图希望泥萌感受到我的绝望

可能是我菜吧.

shit

赛后一发就对我也不知道是什么操作啊(雾)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//my vegetable has exploded. :(
#include<bits/stdc++.h>
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define fi first
#define se second
#define int long long
using namespace std;

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
return x * f;
}
int n,a,b,g[1001][1001],flag = 0;
///------------------head------------------
signed main(signed argc, char *argv[]){
n=read(),a=read(),b=read();
if (a != 1 && b != 1) {puts("NO"); return 0;}
if (n == 2 && a == 1 && b == 1) {puts("NO"); return 0;}
if (n == 3 && a == 1 && b == 1) {puts("NO"); return 0;}
if (a > b) swap(a,b),flag = 1;
for (int i = b; i <= n - 1; i++) g[i][i+1] = g[i+1][i] = 1;
if (!flag)
rep(i,1,n) rep(j,1,n) {if (i==j) continue; g[i][j]^=1;}
puts("YES");
rep(i,1,n)
{
rep(j,1,n)
printf("%d",g[i][j]);
puts("");
}
return 0;
}

/* Examples: */
/*

*/

/*

*/

E

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//my vegetable has exploded. :(
#include<bits/stdc++.h>
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define fi first
#define se second
#define int long long
using namespace std;

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
return x * f;
}
const int MAXN = 1e6+10;
int n,m,k,x[MAXN],ans = LLONG_MAX;
///------------------head------------------
signed main(signed argc, char *argv[]){
n=read(),m=read(),k=read();
while(m--){
int t = read();
x[t] = 1;
}
rep(i,0,n-1){
if (x[i])
{
if (!i) x[i] = -1;
else x[i] = x[i-1];
}
else x[i] = i;
}
rep(i,1,k){
int e1=0,e2=0,y;
y=read();
while(e1 < n){
if (x[e1] < 0 || x[e1] <= e1 - i) break;
e1 = i + x[e1];
++e2;
}
ans = (e1 >= n) ? min(ans,y * e2) : ans;
}
printf("%lld\n",ans==LLONG_MAX?-1:ans);
return 0;
}

/* Examples: */
/*

*/

/*

*/

gg my friend.

明天div2见.

我真的比老狗还菜 加油.