找不到cf 的gym网址了 

先放一个 pdf 凑凑数

链接:https://pan.baidu.com/s/1ZjCX1yg4i8VXM87PD7pppg 
提取码:ru3p 
复制这段内容后打开百度网盘手机App,操作更方便哦

A题 签到题

2291: Rearranging a Sequence

Submit Page    Summary    Time Limit: 2 Sec     Memory Limit: 256 Mb     Submitted: 60     Solved: 30    


Description

You are given an ordered sequence of integers, (1, 2, 3, . . . , n). Then, a number of requests will be given. Each request specifies an integer in the sequence. You need to move the specified integer to the head of the sequence, leaving the order of the rest untouched. Your task is to find the order of the elements in the sequence after following all the requests successively

Input

The input consists of a single test case of the following form.
n m
e1
.
.
.
em
The integer n is the length of the sequence (1 ≤ n ≤ 200000). The integer m is the number
of requests (1 ≤ m ≤ 100000). The following m lines are the requests, namely e1, . . . , em, one per line. Each request ei (1 ≤ i ≤ m) is an integer between 1 and n, inclusive, designating the element to move. Note that, the integers designate the integers themselves to move, not their positions in the sequence.

Output

Output the sequence after processing all the requests. Its elements are to be output, one per line, in the order in the sequence

Sample Input

10 8
1
4
7
3
4
10
1
3

Sample Output

3
1
10
4
7
2
5
6
8
9

思路

(模拟题 题意是将读入的一个个数字放到队伍的队首 最后输出这列数字)

存入数组 倒序输出

对已经输出的数字进行标记 再次遇到就不再输出

最后从 1 ~ n 遍历 将未标记的数字依次输出

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <bits/stdc++.h>
using namespace std;
int a[200005],b[200005];
int main()
{
    int t,m,x;
    scanf("%d%d",&t,&x);
    memset(b,1,sizeof b);
    memset(a,0,sizeof a);
    for (int i=0;i<x;i++)
    {
        scanf("%d",&a[i]);
    }
    for (int i=x-1;i>=0;i--)
    {
        if (b[a[i]]>0)
        {
            printf("%d\n",a[i]);
            b[a[i]]=0;
        }
    }
    for (int i=1;i<=t;i++)
        if (b[i]>0)
        printf("%d\n",i);
    return 0;
}

 

I题 数学题

 

2299: Skinny Polygon

Submit Page    Summary    Time Limit: 20 Sec     Memory Limit: 256 Mb     Submitted: 23     Solved: 4     SpecialJudge


Description

You are asked to find a polygon that satisfies all the following conditions, given two integers, xbb and ybb.

  • The number of vertices is either 3 or 4.
  • Edges of the polygon do not intersect nor overlap with other edges, i.e., they do not share any points with other edges except for their endpoints
  • The x- and y-coordinates of each vertex are integers
  • The x-coordinate of each vertex is between 0 and xbb, inclusive. Similarly, the y-coordinate is between 0 and ybb, inclusive.
  • At least one vertex has its x-coordinate 0.
  • At least one vertex has its x-coordinate xbb
  • At least one vertex has its y-coordinate 0
  • At least one vertex has its y-coordinate ybb
  • The area of the polygon does not exceed 25000

The polygon may be non-convex.

Input

The input consists of multiple test cases. The first line of the input contains an integer n, which is the number of the test cases (1 ≤ n ≤ 105 ). Each of the following n lines contains a test case formatted as follows. xbb ybb xbb and ybb (2 ≤ xbb ≤ 109 , 2 ≤ ybb ≤ 109 ) are integers stated above

Output

For each test case, output description of one polygon satisfying the conditions stated above, in the following format. v x1 y1 . . . xv yv Here, v is the number of vertices, and each pair of xi and yi gives the coordinates of the i-th vertex, (xi , yi). The first vertex (x1, y1) can be chosen arbitrarily, and the rest should be listed either in clockwise or in counterclockwise order. When more than one polygon satisfies the conditions, any one of them is acceptable. You can prove that, with the input values ranging as stated above, there is at least one polygon satisfying the conditions.

Sample Input

2
5 6
1000000000 2

Sample Output

4
5 6
0 6
0 0
5 0
3
1000000000 0
0 2
999999999 0

思路

一直在思考这个题目 

应该是有通解

注意 :non-convex 这个单词表示 非凸包 (我们一开始以为只能是凸包)

那就可以是凹四边形啦~~

先控制底边最小 再控制与底边相对的高最小

 

春游4.1 | 湖南多校赛20190331 / 16东京区域赛

 

在比赛最后一个小时的时候 

我们就想到了 上述方法 

但是 我考虑到 如果 (x-1,y-1)不在四边形内 需要再次寻找该点

所以 重新考虑斜率的值

没想到 数据水啊~~~

刚刚写了一发上述解法的代码 然后在CSU上过了 = =

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    long long x,y;
    scanf("%d",&t);
    for (int i=0;i<t;i++)
    {
        scanf("%lld%lld",&x,&y);
        printf("4\n");
        printf("0 1\n");
        printf("%lld %lld\n",x-1,y-1);
        printf("1 0\n");
        printf("%lld %lld\n",x,y);
    }
    return 0;
}

CSU上过了 

春游4.1 | 湖南多校赛20190331 / 16东京区域赛

在 cf 的gym上过不了 (据说是 gym 的数据比较强) 

春游4.1 | 湖南多校赛20190331 / 16东京区域赛 

数据的锅555

还会再补一次代码

 

我又来了 

啊啊啊啊啊啊啊啊啊 

我就知道要用GCD 但是 队友问我 如果互质咋办

:??????母鸡啊

就没写

看一下 大佬写的题解

https://blog.csdn.net/acterminate/article/details/79246584

之后会补上 手写的分析……

其他题目也改日再补……

相关文章: