結果
問題 | No.1768 The frog in the well knows the great ocean. |
ユーザー | 👑 kmjp |
提出日時 | 2021-11-26 23:13:20 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 189 ms / 3,000 ms |
コード長 | 1,422 bytes |
コンパイル時間 | 2,267 ms |
コンパイル使用メモリ | 213,096 KB |
実行使用メモリ | 17,324 KB |
最終ジャッジ日時 | 2023-09-12 05:56:13 |
合計ジャッジ時間 | 6,613 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 6 ms
4,380 KB |
testcase_02 | AC | 6 ms
4,376 KB |
testcase_03 | AC | 6 ms
4,376 KB |
testcase_04 | AC | 6 ms
4,380 KB |
testcase_05 | AC | 6 ms
4,376 KB |
testcase_06 | AC | 132 ms
7,564 KB |
testcase_07 | AC | 144 ms
9,720 KB |
testcase_08 | AC | 126 ms
8,360 KB |
testcase_09 | AC | 126 ms
7,540 KB |
testcase_10 | AC | 137 ms
9,760 KB |
testcase_11 | AC | 157 ms
10,664 KB |
testcase_12 | AC | 155 ms
10,656 KB |
testcase_13 | AC | 148 ms
10,644 KB |
testcase_14 | AC | 149 ms
10,656 KB |
testcase_15 | AC | 151 ms
10,928 KB |
testcase_16 | AC | 189 ms
17,256 KB |
testcase_17 | AC | 188 ms
17,172 KB |
testcase_18 | AC | 180 ms
17,260 KB |
testcase_19 | AC | 180 ms
17,252 KB |
testcase_20 | AC | 187 ms
17,188 KB |
testcase_21 | AC | 2 ms
4,376 KB |
testcase_22 | AC | 2 ms
4,376 KB |
testcase_23 | AC | 3 ms
4,380 KB |
testcase_24 | AC | 107 ms
4,380 KB |
testcase_25 | AC | 132 ms
17,324 KB |
testcase_26 | AC | 131 ms
17,208 KB |
testcase_27 | AC | 2 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;} template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;} //------------------------------------------------------- int T; int N; int A[202020]; int B[202020]; int L[202020],R[202020]; void solve() { int i,j,k,l,r,x,y; string s; cin>>T; while(T--) { cin>>N; set<int> W; vector<pair<int,int>> P; FOR(i,N) { cin>>A[i]; P.push_back({-A[i],i}); } sort(ALL(P)); W.insert(-1); W.insert(N); FOR(i,N) { x=P[i].second; auto it=W.lower_bound(x); R[x]=*it-1; L[x]=*prev(it)+1; W.insert(x); } FOR(i,N) cin>>B[i]; int cur=0; FOR(i,N) { while(cur<N&&(A[cur]!=B[i]||(i<L[cur]||i>R[cur]))) cur++; if(cur==N) break; } if(i==N) cout<<"Yes"<<endl; else cout<<"No"<<endl; } } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); cout.tie(0); solve(); return 0; }