A Few Laughing Men
A Few Laughing Men
Balaji is a great person to hang out with. He tells really amazing jokes, though sometimes he also slips some very boring ones in between. Today, he told N jokes to Arjun. We have this information in an array J of size N recorded and given to us by Vaibhav, where each entry can be either 1 or -1. 1 denotes that the joke was amazing, whereas -1 signifies the joke was boring and too poor to get even a forced smile from our nice Arjun.
Arjun being a sensible person, can distinguish amazing and boring jokes easily. He usually laughs only at amazing jokes. But today morning he had a session of laughter yoga, and he is very happy and elated. So, whenever he hears some amazing jokes, he laughs with strictly more intensity than the previous amazing joke that he heard. As usual, if you tell a boring joke, he won't care much about it and will respond arbitrarily. That is, you can't say anything about his laugh intensity. It could be anything.
Vaibhav was present during this laughing session. He recorded the events, but since he has not seen Arjun before, he is not sure if it was actually Arjun or someone else who was laughing. He has recorded the type of the N jokes in array J. Also, the laughter intensities were recorded in an array L of size N by an automated sophisticated equipment called the intensometer. The ith entry of this array denotes the intensity with which the person laughed at the ith joke. But we do not trust Vaibhav fully. Through our very trusted sources Animesh and Akashdeep, it came to light that Vaibhav might have slept for a short duration during the session. But we know that if at all he slept, he slept only for a short enough time and so he could only have miswritten the joke type of at most one joke. That is, he could have misclassified at most one amazing joke as a boring one, or vice-versa. As intensities are calculated using the intensometer, they have been recorded precisely and there are no errors in it.
So, given the array J, and the array L, we should identify whether the person laughing could have been Arjun or not. Note that Arjun could laugh at an amazing joke with intensity 0.
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T cases follow.
The first line of each test case contains a single integer N denoting the number of jokes Balaji told.
The second line of each test case contains N space separated integers denoting the array J.
The third line of each test case contains N space separated integers denoting the array L.
Output
For each test case, output a single line containing "#laughing_arjun" or "#itsnot_arjun". You should output "#itsnot_arjun" if you are sure that the person whose laugh intensities have been recorded is not Arjun. But if it could be Arjun, you should output "#laughing_arjun".
Constraints
- 1 ≤ T ≤ 105
- 1 ≤ N ≤ 105
- Ji = 1 or -1
- 0 ≤ Li ≤ 109
- There will be no two jokes with the same intensity.
- Sum of N over all the test cases in a single file ≤ 106.
Example
Input
4
4
1 1 -1 1
1 3 2 4
4
1 1 -1 1
3 1 2 4
4
1 1 -1 1
4 3 2 1
4
-1 -1 -1 -1
4 3 2 1 Output
#laughing_arjun
#laughing_arjun
#itsnot_arjun
#laughing_arjun
Explanation
Example case 1. Only the third joke was boring. All other jokes were amazing. The person laughed in increasing intensity over the good jokes (1 3 4), so he could be Arjun.
Example case 2. Similar to the previous testcase, the third joke was boring. All other jokes were amazing. But the person didn't laugh in increasing intensity over the amazing jokes (3 1 4). However, Vaibhav might have been sleeping and he could have misrecorded the first joke as an amazing joke. In that case, the laughing intensities over the amazing jokes will be 1 4, which is in increasing order. So, this person could be Arjun.
Example case 3. The third joke was boring again. The person didn't laugh in increasing intensity over the amazing jokes (4 3 1). Even if Vaibhav was sleeping, the recorded intensities over the amazing jokes could only be (3, 1), (4, 1), or (4, 3). None of these are increasing, and so this person is definitely not Arjun.
Example case 4. All the jokes were boring. Arjun could have laughed in any intensity order. So this can be Arjun.
去掉一个看是不是递增序列
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lson l,mi,rt<<1
#define rson mi,r,rt<<1|1
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define pll pair<long long,long long>
#define pii pair<int,int>
#define pq priority_queue
const int N=1e6+,MD=1e9+,INF=0x3f3f3f3f;
const ll LL_INF=0x3f3f3f3f3f3f3f3f;
const double eps=1e-,e=exp(),PI=acos(-.);
int a[N],b[N],sta[N];
int main()
{
ios::sync_with_stdio(false),cin.tie(),cout.tie();
int T;
cin>>T;
while(T--)
{
int n,tot=;
sta[]=-;
cin>>n;
for(int i=;i<n;i++)cin>>a[i];
for(int i=;i<n;i++)cin>>b[i];
int f1=,f2=;
for(int i=;i<n;i++)
{
if(a[i]==-)continue;
if(b[i]>sta[tot])sta[++tot]=b[i];
else if(f1)
{
f2=;
break;
}
else
f1=,sta[tot]=b[i]>sta[tot-]?b[i]:sta[tot];
}
printf(f2?"#itsnot_arjun\n":"#laughing_arjun\n");
}
return ;
}
A Few Laughing Men的更多相关文章
- Things about single men that women hate
Things about single men that women hate为何你俘获不了女神的心?If you listen in to a group of single women talki ...
- Men and women can't be 'just friends
Men and women can't be 'just friends' Can heterosexual men and women ever be "just friends" ...
- 广告狂人第一至七季/全集Mad Men迅雷下载
广告狂人 第一季 Mad Men Season 1 (2007) 本季看点:你是谁?你想要什么?你爱乾什么?这些都不重要,重要的是你怎么把东西卖出去.凡是了解纽约的人都知道,今天,在麦迪逊大道(Mad ...
- 好汉两个半第十二季/全集Two and a Half Men迅雷下载
本季Two And A Half Men Season 12 (2014)看点:<好汉两个半>的“半个”是因为第一季播出时杰克年纪太小,只能算半个.故事就在这三个主角和他们周围的女人中发生 ...
- 好汉两个半第一季/全集Two And A Half Men迅雷下载
第一季 Two and a Half Men Season 1 (2003)看点:Charlie是一个潇洒自由的单身汉,但正面临离婚危机的兄弟Alan带着儿子Jake的突然来访完全打乱了Charlie ...
- 每日英语:The Benefits of a Better Men's T-Shirt
"I WEAR A T-shirt and jeans every single day," said Erik Schnakenberg, 30, co-founder of t ...
- 每日英语:He Diets, She Diets: More Weight-Loss Plans Target Men
Weight-loss companies are becoming savvier about getting men to go on a diet. savvier:更加精明 Men and w ...
- All men are brothers
All men are brothers 牛客多校第九场E 给定n个人,起初互不认识 然后m各阶段 每个阶段有两个人x.y认识 求每个阶段选出四个人互不认识的方式 并查集 #include<bi ...
- 【Kata Daily 190919】Sort Out The Men From Boys(排序)
题目: Scenario Now that the competition gets tough it will Sort out the men from the boys . Men are th ...
随机推荐
- Yii2 的快速配置 api 服务 yii2-fast-api
yii2-fast-api yii2-fast-api是一个Yii2框架的扩展,用于配置完善Yii2,以实现api的快速开发. 此扩展默认的场景是APP的后端接口开发,因此偏向于实用主义,并未完全采用 ...
- MySql自动默认时间及更新时间
注意:5.7 才能用类型为datetime的字段实现 `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `modifie ...
- 转:error LNK2005: ...already defined in MSVCRTD.lib
编译错误: Error1error LNK2005: _CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.l ...
- JavaScript_2_实现
1. HTML中的脚本必须位于<script>与</script>标签之间 JavaScript是所有现代浏览器以及HTML5中的默认脚本语言 2. 脚本可被放置在HTML页面 ...
- 【Python图像特征的音乐序列生成】关于mingus一个bug的修复,兼改进情感模型
mingus在输出midi文件的时候,使用这样的函数: from mingus.containers import NoteContainer from mingus.midi import midi ...
- codeforces Gym 100286J Javanese Cryptoanalysis (二染色)
每一单词相邻两个字母,不能同时为元音或者辅音... 各种姿势都可以过:7个for,dp,黑白染色,dfs,并查集.... 最主要的思路就是相邻字母连边,把元音和辅音看成两个集合,那么有连边的两个字母一 ...
- python_103_属性方法例子
class Flight(object): def __init__(self,name): self.flight_name = name def checking_status(self): pr ...
- js学习笔记-字符串
1.需要注意的是,JavaScript 的字符串是不可变的(immutable),String 类定义的方法都不能改变字符串的内容.像 String.toUpperCase() 这样的方法,返回的是全 ...
- equals和HashCode的羁绊
equals和hashcode我一直没弄明白到底怎么回事,今天终于弄懂了. 如下图: 在Person类没有重写equals和hashcode方法时,是如下情况: 但是当我重写了equals方法时,是如 ...
- ll1文法
<program>-><external_declaration> | <program> <external_declaration> < ...