惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
Y
Y Combinator Blog
T
Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
MyScale Blog
MyScale Blog
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
量子位
I
Intezer
Simon Willison's Weblog
Simon Willison's Weblog
C
Cybersecurity and Infrastructure Security Agency CISA
L
Lohrmann on Cybersecurity
L
LINUX DO - 最新话题
The Register - Security
The Register - Security
T
Tailwind CSS Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
Stack Overflow Blog
Stack Overflow Blog
Cloudbric
Cloudbric
S
Secure Thoughts
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
L
LangChain Blog
Recorded Future
Recorded Future
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Tor Project blog
人人都是产品经理
人人都是产品经理
F
Full Disclosure
O
OpenAI News
Webroot Blog
Webroot Blog
A
Arctic Wolf
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
B
Blog RSS Feed
Vercel News
Vercel News

Sehnsucht

记一次博客换图床的过程 观《花束般的恋爱》 读《活过》 东京 旅行篇 亲人逝去 我为什么想养鱼 防止AI爬取你的博客 「monthly 」博客重构 游戏全成就 好看的小说 人生的每一步都不会是浪费-2024年终 「weekly」星期五综合征 「weekly」听播客 杂谈 读《美丽新世界》 「weekly」社交媒体 恶性事件 新世界 「weekly」认知觉醒 美丽新世界 follow 「weekly」独立博客9问题 双十一买书 读《惊呆了!原来这就是社会学》 一次聊天与自我建设 2024-09月记 补番《relife》 树状数组简单理解 lvm简单使用 博客自动发布方案 某公众号废案 fail2ban基本使用 Podman 环境使用 Nginx Proxy Manager 最佳实践 2024-07同学聚会 vps使用podman部署freshrss Gitlab CICD 实践,思考与记录 装备升级:新的PC gitlab局域网搭建流程 FastMail迁移至GMail+Cloudflare Email Routing 读《黑客与画家》 leetcode 第 391 场周赛 Astro添加过渡后DarkModeToggle按钮失效 nuxt3使用echarts5渲染中国地图 人生刻度 又到凤凰花朵开放的时候 2023-05-10 实习结束 2023-04-26 广州博物馆游记 YOASOBI「たぶん」官方音乐视频 风灵玉秀-发如雪 带我的老哥离职了 从p10k转向Starship lunarvim国内安装踩坑记录 什么是对称加密非对称加密、密钥交换、数字签名、证书 强调体验的一种思考时间的方式 ArchLinux使用vscode编写latex报错The font "FontAwesome" cannot be found ArchLinux安装(移动硬盘)流程 yay一个或多个文件没有通过有效性检查! 2022年终 hugo建站伊始 clash设置relay前置代理(校园网破解改进记录) 群青 · YOASOBI · Ayase 华为 matepad pro 11使用体验 Nginx使用acme.sh免费安装ssl证书 永远属于你的安娜 在线 童年趣事 童心,是比野心更难得的梦想 2021年终总结 基于jeeSite的软件测试课程作业 流程记录 Linux不同用户安装不同版本jdk Wifi4更换Wifi6路由器的使用体验 Flask 上传图片并灰度显示 玩客云刷机debain个人记录 jython 简单入门 Jenkins 个人搭建流程记录 集成邮件系统(qq邮箱),gitlab服务器,freestyle风格 在Web项目中配置Log4j --指南-- Codeforces Round 753 (Div. 3) ABCDE 浅谈fork函数 JavaWeb servlet 使用Cookie记录用户访问次数 Codeforces Round Educational Codeforces Round 114 (Rated for Div. 2) ABC 2021牛客多校7 I xay loves or 2021牛客多校9 H Happy Number 2021牛客多校8 D OR 2021牛客多校5 B Boxes 2021牛客多校5 H Holding Two 2021牛客多校1 F Find 3-friendly Integers 2021牛客多校1 B Ball Dropping 记人生第一次投简历和笔试 原型模式 2021-2-20 雨时随记 关于一维差分数组的例子 halo个人建站 关于手机ping电脑和电脑ping手机 泛型类简单理解 CodeForces - 849C From Y to Y 2020牛客国庆集训派对day3 Leftbest 约瑟夫环问题---2020牛客国庆集训派对day2 AKU NEGARAKU mysql 5.7 忘记密码如何更改 CF 1099B Squares and Segments CF 998A Balloons CF 998B Cutting 链表应用之多项式相加 CF 1150A Stock Arbitraging CF 1199A City Day CF 1199B Water Lily CF 982A Row CF 934A A Compatible Pair CF 629B Far Relative’s Problem 651A Joysticks 651B Beautiful Paintings
2021牛客多校2 D Er Ba Game
2021-07-19 · via Sehnsucht

链接:https://ac.nowcoder.com/acm/contest/11253/D 来源:牛客网

时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld

题目描述

Er Ba Game is a popular card game in China’s Province Zhejiang.

In this problem, the game involves two players and 36 cards - 2,3,⋯ ,102,3,\cdots, 102,3,⋯,10, each with four.

In the game each player takes 2 cards (a1,b1)(a_1,b_1)(a1​,b1​) , (a2,b2)(a_2,b_2)(a2​,b2​) .Player i{i}i gets (ai,bi)(a_i,b_i)(ai​,bi​) . Suppose a1≤b1,a2≤b2a_1\leq b_1,a_2\leq b_2a1​≤b1​,a2​≤b2​, and we determine the winner as follow:

  1. ​ (2,8){(2,8)}(2,8) is the biggest pair.

  2. ​ If neither is (2,8){(2,8)}(2,8), a pair with a=b{a=b}a=b is greater than a pair without.

  3. ​ If a1=b1a_1=b_1a1=b1 and a2=b2a_2=b_2a2=b2, then compare a1,a2a_1,a_2a1,a2.The bigger one wins.

  4. ​ If a1≠b1,a2≠b2a_1\ne b_1,a_2\ne b_2a1\=b1,a2\=b2, compare (a1+b1) mod 10,(a2+b2) mod 10(a_1+b_1)\ \text{mod}\ 10,(a_2+b_2)\ \text{mod}\ 10(a1+b1) mod 10,(a2+b2) mod 10.The bigger one wins.

  5. ​ If a1≠b1,a2≠b2a_1\ne b_1,a_2\ne b_2a1\=b1,a2\=b2 and (a1+b1) mod 10=(a2+b2) mod 10(a_1+b_1)\ \text{mod}\ 10=(a_2+b_2)\ \text{mod}\ 10(a1+b1) mod 10=(a2+b2) mod 10,compare b1,b2b_1,b_2b1,b2.The bigger one wins.

If a1≤b1,a2≤b2a_1\leq b_1,a_2\leq b_2a1≤b1,a2≤b2 does not hold, we can exchange a1a_1a1 and b1b_1b1 or exchange a2a_2a2 and b2b_2b2 until the formula holds.

You’re told a1,b1,a2,b2a_1,b_1,a_2,b_2a1,b1,a2,b2, and you should tell who’s gonna win the game.

输入描述:

The first line contains an integer T{T}T — number of game cases.
Then T{T}T lines, each contains four integers a1,b1,a2,b2a_1,b_1, a_2,b_2a1,b1,a2,b2, denoting the cards of each player.

输出描述:

Output T{T}T lines.


If player 1 wins, output "first" (without quote).


If player 2 wins, output "second" (without quote).


Otherwise, output "tie" (without quote).

示例1

输入

复制

5
2 8 4 6
6 6 6 7
4 5 5 5
6 3 9 10
7 2 2 7

输出

复制

first
first
second
second
tie

说明

The answers to the first four sets of data are obtained through the first, second, second, and fifth rules respectively.

备注:

It's guaranteed that T≤100,2≤a1,b1,a2,b2≤10T\leq 100,2\leq a_1,b_1,a_2,b_2\leq 10T≤100,2≤a1,b1,a2,b2≤10.

It's not guaranteed that a1≤b1,a2≤b2a_1\leq b_1,a_2\leq b_2a1≤b1,a2≤b2.

思路与代码

简单模拟 看懂题目后按照题目意思写就行

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <vector>
#include <limits.h>
#include <assert.h>
#include <functional>
#include <numeric>
#include <ctime>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define pb          push_back
#define ppb         pop_back
#define lbnd        lower_bound
#define ubnd        upper_bound
#define endl        '\n'
#define mll         map<ll,ll>
#define msl         map<string,ll>
#define mls         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x)  for(auto& a : x)
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define vll         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define DEBUG       cerr<<"/n>>>I'm Here<<</n"<<endl;
#define display(x)  trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;
#define ini(a)      memset(a,0,sizeof(a))
#define ini2(a,b)   memset(a,b,sizeof(a))
#define rep(i,a,b)  for(int i=a;i<=b;i++)
#define sc          ll T;cin>>T;for(ll Q=1;Q<=T;Q++)
#define lowbit(x)   x&(-x)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define DBG(x) \
    (void)(cout << "L" << __LINE__ \
    << ": " << #x << " = " << (x) << '\n')
#define TIE \
    cin.tie(0);cout.tie(0);\
    ios::sync_with_stdio(false);

//using namespace __gnu_pbds;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int maxn = 2000;
const int N = 500009;


void solve(){
	int a1,b1,a2,b2,ans = 0;
	cin>>a1>>b1>>a2>>b2;
	if(a1>b1)a1^=b1^=a1^=b1;
	if(a2>b2)a2^=b2^=a2^=b2;
	if(a1==a2&&b1==b2){//相等 
		ans = 0;
	}else if(a1==2&&b1==8){
		ans = 1;
	}else if(a2==2&&b2==8){
		ans = 2;
	}else if(a1==b1&&a2==b2){
		if(a1>a2){
			ans = 1;
		}else if(a1<a2){
			ans = 2;
		}else{
			ans = 0;
		}
	}else if(a1==b1){
		ans = 1;
	}else if(a2==b2){
		ans = 2;
	}else if(a1!=b1&&a2!=b2){
		int q1 = (a1+b1)%10;
		int q2 = (a2+b2)%10;
		if(q1>q2)ans = 1;
		else if(q1<q2)ans = 2;
		else{
			if(b1>b2)ans = 1;

			else if(b1<b2)ans = 2;
			else ans = 0;
		}
	}else{
		ans = 0;
	}
	if(ans==0){
		cout<<"tie"<<endl;
	}else if(ans==1){
		cout<<"first"<<endl;
	}else{
		cout<<"second"<<endl;
	}
}

int main()
{
//    #ifndef ONLINE_JUDGE
//    freopen ("input.txt","r",stdin);
//    #else
//    #endif
//	solve();
    sc{solve();}
//    int p;
//    while(cin>>p){
//    	while(p--){
//    		solve();
//		}
//	}
//    sc{cout<<"Case "<<Q<<":"<<endl;solve();}
}