2022.11.23

倒计时 2 天了!

$ $

困~~~~

用我前天买的奶茶的杯子泡上咖啡,这个杯子真的好大!

用它喝水好有牌面。

嫖题,嫖题!

8:35 开始!

$ $

T1 什么东西?dp ? 还是个小清新题?

T2 什么东西?

T3 什么东西?好像能写暴力。

T4 什么东西?

$ $

冲动是魔鬼,有思路了之后,再想一想在下爪子。

现在是10:30, 我只写了 T4。

不过这真的是 T4 吗?是否过于草率了?

$ $

喜提这几天的最好成绩。

$ $

下午聂老师说可以搬书,YCC又开始瞻前顾后。

浪费了时间还没有结果。

继续复习。(dog 都不补题!)

$ $

A

假的,60pts

开 long long 70pts。

/*
Date:
Source:
knowledge:
*/
#include <cstdio>
#include <iostream>
#include <cstring>
#define orz cout << "AK IOI" << "\n";

using namespace std;
const int maxn = 61000000; 

inline int read()
{
    int x = 0, f = 1;  char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1; ch = getchar();}
    while(ch <= '9' && ch >= '0') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
    return x * f;
}
inline void print(int X)
{
    if(X < 0) X = ~(X - 1), putchar('-');
    if(X > 9) print(X / 10);
    putchar(X % 10 ^ '0');
    return ;
}
inline int Max(int a, int b){
    return a > b ? a : b;
}
inline int Min(int a, int b){
    return a < b ? a : b;
}
char s[maxn];
int str[maxn], top, q[maxn], head, tail, ans;
int main()
{
    //freopen(".in", "r", stdin);  
    //freopen(".out", "w", stdout);
    scanf("%s", s + 1);
    int len = strlen(s + 1);
    for(int i = 1; i <= len; i++)
    {
        if(s[i] == '(') 
        {
            if(tail == head) str[++top] = i;
            else 
            {
                ans += (i - q[head + 1]), head++;
                for(int j = head; j <= tail; j++) q[j] += 1;
            }
        }
        if(s[i] == ')')
        {
            if(top != 0) top--;
            else q[++tail] = i;
        }
    }
    print(ans);
    //fclose(stdin); 
    //fclose(stdout);
    return 0;
}
/*
)(()())( 2
))()()(( 7
))(( 3 
*/

隔壁的 AC 代码。

    cin >> s;
    int n = strlen(s); 
    for(int i = 0;i < n; i ++){
        if(s[i] == '('){
            if(suma - sumb < 0){
                ans += sumb - suma;
            }
            suma ++;
        }
        else sumb ++;
    }
    cout << ans << '\n';

D

/*
Date:2022.11.23
Source:模拟赛 
knowledge:全排列是有什么性质?
        行了,看啥都像dp了 
        主动权在谁那里呢?都是大聪明怎么搜索呢?
        倒着想!!! 
        最后一名评价最小的一定会被删除,不是自己删就是被前边的大聪明删了。
        从后向前删!!!! 
        但是这是最后一题啊!!!怎么可能! 
*/
#include <cstdio>
#include <iostream>
#define orz cout << "AK IOI" << "\n";

using namespace std;
const int maxn = 2010;

inline int read()
{
    int x = 0, f = 1;  char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1; ch = getchar();}
    while(ch <= '9' && ch >= '0') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
    return x * f;
}
inline void print(int X)
{
    if(X < 0) X = ~(X - 1), putchar('-');
    if(X > 9) print(X / 10);
    putchar(X % 10 ^ '0');
    return ;
}
inline int Max(int a, int b){
    return a > b ? a : b;
}
inline int Min(int a, int b){
    return a < b ? a : b;
}
int n, a[maxn][maxn], vis[maxn]; 
int main()
{
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    n = read();
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n + 1; j++) a[i][j] = read();
    for(int i = n; i >= 1; i--)
    {
        int Minn = 0x3f3f3f3f, now = 0;
        for(int j = 1; j <= n + 1; j++)
        {
            if(vis[j]) continue;
            if(Minn > a[i][j]) Minn = a[i][j], now = j;
        }
        vis[now] = 1;
    }
    for(int i = 1; i <= n + 1; i++) 
        if(vis[i] == 0) print(i);
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

北极通讯网络

/*
Date: 2022.10.22
Source: LOJ
knowledge: 二分 + 最小生成树 
*/
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#define orz cout << "AK IOI" << "\n";

using namespace std;
const int maxn = 510;

inline int read()
{
    int x = 0, f = 1;  char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1; ch = getchar();}
    while(ch <= '9' && ch >= '0') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
    return x * f;
}
inline void print(int X)
{
    if(X < 0) X = ~(X - 1), putchar('-');
    if(X > 9) print(X / 10);
    putchar(X % 10 ^ '0');
    return ;
}
inline int Max(int a, int b){
    return a > b ? a : b;
}
inline int Min(int a, int b){
    return a < b ? a : b;
}
int n, k, fa[maxn];
double edge[maxn * maxn]; 
struct node{
    int u, v;
    double w;
}e[maxn * maxn << 1];
struct vill{
    int x, y;
}a[maxn];
double getdis(vill a, vill b)
{
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
bool cmp(node a, node b)
{
    return a.w < b.w;
}
int find(int x)
{
    if(fa[x] == x) return x;
    return fa[x] = find(fa[x]);
}

int main()
{
    //freopen(".in", "r", stdin);  
    //freopen(".out", "w", stdout);
    n = read(), k = read();
    for(int i = 1; i <= n; i++) fa[i] = i;
    for(int i = 1; i <= n; i++) a[i].x = read(), a[i].y = read();
    int js = 0;
    for(int i = 1; i <= n; i++)
        for(int j = i + 1; j <= n; j++) 
        {
            e[++js].u = i, e[js].v = j;
            e[js].w = getdis(a[i], a[j]); 
        }
    sort(e + 1, e + js + 1, cmp);
    int cnt = 0;
    for(int i = 1; i <= js; i++)
    {
        int fx = find(e[i].u), fy = find(e[i].v);
        if(fx != fy) fa[fx] = fy, edge[++cnt] = e[i].w; 
    }
    //for(int i = 1; i <= cnt; i++) printf("%.2lf ", edge[i]);
    if(k >= n) puts("0");
    else printf("%.2lf", edge[cnt - k + 1]);
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

新的开始

posted @ 2022-11-23 22:37  _程门立雪  阅读(45)  评论(0编辑  收藏  举报