题目链接  Qingdao

Problem C

AC自动机还不会,暂时暴力水过。

#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b)	for (int i(a); i <= (b); ++i)
#define dec(i, a, b) for (int i(a); i >= (b); --i) const int N = 1e5 + 10; string s[N];
int T;
int n;
int ans; int main(){ std::ios::sync_with_stdio(false); cin >> T;
while (T--){
cin >> n;
int id;
int maxv = 0;
for(int i = 1; i <= n; i++) {
cin >> s[i];
if (s[i].size() > maxv) {
maxv = s[i].size();
id = i;
}
}
ans = 1;
rep(i, 1, n) if (s[id].find(s[i]) == -1){ ans = 0; break;}
if (ans) cout << s[id] << endl;
else cout << "No" << endl;
} return 0;
}

Problem J

考虑直接用队列保存待判断的元素(出队or not)

然后直接用链表模拟就可以了。

为什么比赛的时候我不会做呢

#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b)	for (int i(a); i <= (b); ++i)
#define dec(i, a, b) for (int i(a); i >= (b); --i)
#define MP make_pair
#define fi first
#define se second typedef long long LL; const int N = 1e5 + 10; struct node{
int x, l, r;
} a[N]; int T;
int n, ans;
queue <int> q; int main(){ scanf("%d", &T);
while (T--){
scanf("%d", &n);
rep(i, 1, n){
a[i].l = i - 1;
scanf("%d", &a[i].x);
a[i].r = i + 1;
} a[0].r = 1;
a[n + 1].l = n;
a[0].x = 0;
a[n + 1].x = 1e8; while (!q.empty()) q.pop(); rep(i, 1, n) q.push(i);
while (!q.empty()){
int now = q.front(); q.pop();
int suc = a[now].r;
int pre = a[now].l;
if (a[now].x > a[suc].x){
q.push(pre);
a[pre].r = a[suc].r;
a[a[suc].r].l = pre;
a[suc].l = pre;
}
} ans = 0;
int now = a[0].r;
while (now <= n){
++ans;
now = a[now].r;
} printf("%d\n", ans);
now = a[0].r;
while (now <= n){
printf("%d ", a[now].x);
now = a[now].r;
} putchar(10);
} return 0;
}

Problem K

签到

#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b)	for (int i(a); i <= (b); ++i)
#define dec(i, a, b) for (int i(a); i >= (b); --i)
#define MP make_pair
#define fi first
#define se second typedef long long LL; LL a[1001000], b[1001000];
LL n;
int T; int main(){ for (LL i = 1; i <= 1000000; ++i) a[i] = i * i * i;
rep(i, 1, 999999) b[i] = a[i + 1] - a[i]; scanf("%d", &T);
while (T--){
scanf("%lld", &n);
bool fl = false;
rep(i, 1, 999999) if (b[i] == n){
fl = true;
break;
} if (fl) puts("YES"); else puts("NO");
} return 0;
}

  

2017 ACM/ICPC Asia Regional Qingdao Online 记录的更多相关文章

  1. 2017 ACM/ICPC Asia Regional Qingdao Online

    Apple Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submi ...

  2. HDU - 6215 2017 ACM/ICPC Asia Regional Qingdao Online J - Brute Force Sorting

    Brute Force Sorting Time Limit: 1 Sec  Memory Limit: 128 MB 题目连接 http://acm.hdu.edu.cn/showproblem.p ...

  3. 2017 ACM/ICPC Asia Regional Qingdao Online解题报告(部分)

    HDU 6206 Apple 题意: 给出四个点的坐标(每个点的坐标值小于等于1,000,000,000,000),问最后一个点是否在前三个点组成的三角形的外接圆内,是输出Accept,否输出Reje ...

  4. 2017 ACM/ICPC Asia Regional Qingdao Online Solution

    A : Apple 题意:给出三个点,以及另一个点,求最后一个点是否在三个点的外接圆里面,如果在或者在边界上,输出“Rejected”,否则输出"Accepted" 思路:先求一个 ...

  5. 2017 ACM/ICPC Asia Regional Qingdao Online - 1011 A Cubic number and A Cubic Number

    2017-09-17 17:12:11 writer:pprp 找规律,质数只有是两个相邻的立方数的差才能形成,公式就是3 * n * (n + 1) +1, 判断读入的数是不是满足 这次依然只是做了 ...

  6. 2017 ACM/ICPC Asia Regional Qingdao Online - 1008 Chinese Zodiac

    2017-09-17 13:28:04 writer:pprp 签到题:1008 Chinese Zodiac #include <iostream> #include <strin ...

  7. 2017 ACM/ICPC Asia Regional Guangxi Online 记录

    题目链接  Guangxi 感觉这场比赛完全是读题场啊…… 比赛过程中丢失了一波进度,最后想开题的时候已经来不及了…… Problem A 按题意模拟……按照那个矩阵算就可以了 #include &l ...

  8. 2017 ACM/ICPC Asia Regional Beijing Online 记录

    题目链接  Beijing

  9. 2017 ACM/ICPC Asia Regional Xian Online 记录

    题目链接  Xian

随机推荐

  1. EMVS: Event-based Multi-View Stereo 阅读笔记

    0. 摘要 EMVS目的:从已知轨迹的event相机,估计半稠密的3D结构 传统的MVS算法目的:从已知视点的图片集,去估计场景的稠密3D结构. EMVS2个固有属性: (1)   当传感器发生相对运 ...

  2. Arch Linux 天坑

    https://wiki.archlinux.org/index.php/Samba_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) samba  gui客户端 smb4 ...

  3. 使用gcc -g编译,gdb调试时仍然存在“no debug symbols found”的错误

    今天为调试一段代码,使用gcc将程序用-g选项重新编译.但是使用gdb进行debug时,仍然出现“no debug symbols found”的错误.仔细检查了一下Makefile,原来后面定义的连 ...

  4. JavaWeb项目中集成Swagger API文档

    1.增加依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-sw ...

  5. (三)Python3 循环语句——while

    while语句的一般形式: while 判断条件: 语句 同样需要注意冒号和缩进.另外,在 Python 中没有 do..while 循环. 以下实例使用了 while 来计算 1 到 100 的总和 ...

  6. LeetCode(98) Validate Binary Search Tree

    题目 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined ...

  7. cocos2d-x游戏开发(二)之创建第一个项目

    配置好开发环境之后,尝试创建一个cocos项目 (1)打开cocos2d-x安装目录,如D:\DIY\cocos2d-x-3.3 看到目录下有可执行文件 download-deps 以及 setup ...

  8. JAVA面向过程VS面向对象

    面向过程 面向过程是一种自顶向下的编程,强调行为过程,可扩展性可维护性差. 优点: 性能比面向对象高,因为类调用时需要实例化,开销比较大,比较消耗资源. 单片机.嵌入式开发.Linux/Unix等一般 ...

  9. Memcached特性及优缺点

    为了加快文件访问速度且提供多个使用者.需要在内存中建立内存缓存数据的管理减小读写磁盘的次数及保证数据的更新.因为需要使用cache缓存.   1.Memcached 主要特性 a.数据仅存在于内存中, ...

  10. Android AAR 混淆的坑

    一定不要忘记加上这段 -keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,A ...