結果
| 問題 | No.3611 Omega Cat(Judging ver.) |
| コンテスト | |
| ユーザー |
37zigen
|
| 提出日時 | 2026-08-10 18:15:35 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 137 ms / 2,000 ms |
| + 734µs | |
| コード長 | 4,533 bytes |
| 記録 | |
| コンパイル時間 | 1,539 ms |
| コンパイル使用メモリ | 87,312 KB |
| 実行使用メモリ | 44,664 KB |
| 最終ジャッジ日時 | 2026-08-10 18:15:42 |
| 合計ジャッジ時間 | 6,106 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | AC * 1 |
| 小課題1 | 20 % | AC * 6 |
| 小課題2 | 40 % | AC * 19 |
| 小課題3 | 40 % | AC * 33 |
| 合計 | 1.5 * 100% = 150 点 |
ソースコード
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
public class Main {
static MyPrintWriter pw = MyPrintWriter.getInstance();
static FastScanner sc = FastScanner.getInstance();
public static void main(String[] args) throws IOException {
Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
new Main().run();
pw.flush();
}
void run() {
int T = sc.nextInt();
for (int TEST = 0; TEST < T; TEST++) {
int N = sc.nextInt();
var H = sc.nextInts(N);
int cnt = 0;
for (int i = 0; (i + 2) < N; i++) {
if ((H[i] < H[i + 1]) != (H[i + 1] < H[i + 2])) {
++cnt;
}
}
if ((cnt == 3) && (H[0] > H[1])) {
pw.printlnYesNo(true);
} else {
pw.printlnYesNo(false);
}
}
}
}
class FastScanner {
private static FastScanner instance = null;
private final InputStream in = System.in;
private final byte[] buffer = new byte[1 << 16];
private int ptr = 0;
private int buflen = 0;
private FastScanner() {
}
public static FastScanner getInstance() {
if (instance == null) {
instance = new FastScanner();
}
return instance;
}
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
}
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
return buflen > 0;
}
private int readByte() {
if (hasNextByte()) {
return buffer[ptr++];
} else {
return -1;
}
}
private boolean isPrintableChar(int c) {
return (33 <= c) && (c <= 126);
}
public boolean hasNext() {
while (hasNextByte() && (!isPrintableChar(buffer[ptr]))) {
ptr++;
}
return hasNextByte();
}
public long nextLong() {
if (!hasNext()) {
throw new NoSuchElementException();
}
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
while ((b >= '0') && (b <= '9')) {
// n = n * 10 + (b - '0');
n = ((n << 1) + (n << 3)) + (b - '0');
b = readByte();
}
return minus ? -n : n;
}
public int nextInt() {
return ((int) (nextLong()));
}
public int[] nextInts(int n) {
int[] a = new int[n];
for (int i = 0; i < n; ++i) {
a[i] = nextInt();
}
return a;
}
}
class MyPrintWriter extends PrintWriter {
private static MyPrintWriter instance = null;
private MyPrintWriter() {
super(System.out);
}
public static MyPrintWriter getInstance() {
if (instance == null) {
instance = new MyPrintWriter();
}
return instance;
}
public void printlnYesNo(boolean flag) {
println(flag ? "Yes" : "No");
}
}
// --- Original Code ---
//
//
// import java.io.IOException;
// import java.util.ArrayList;
// import java.util.Arrays;
//
// import library.tools.FastScanner;
// import library.tools.MergeFiles;
// import library.tools.MyPrintWriter;
// import library.util.ArrayUtils;
// import library.util.Fp;
// import library.util.collections.LongArrayList;
// import library.util.graph.ImplicitDigraph;
//
// public class Main {
// static MyPrintWriter pw = MyPrintWriter.getInstance();
// static FastScanner sc = FastScanner.getInstance();
//
// public static void main(String[] args) throws IOException {
// new Main().run();
// pw.flush();
// MergeFiles.export();
// }
//
//
// void run() {
// int T=sc.nextInt();
// for (int TEST = 0; TEST < T; TEST++) {
// int N=sc.nextInt();
// var H=sc.nextInts(N);
// int cnt=0;
// for (int i = 0; i+2 < N; i++) {
// if(H[i]<H[i+1]!=H[i+1]<H[i+2])++cnt;
// }
// if(cnt==3 && H[0] > H[1]) {
// pw.printlnYesNo(true);
// } else {
// pw.printlnYesNo(false);
// }
// }
// }
//
// void tr(Object... objects) {
// System.out.println(Arrays.deepToString(objects));
// }
// }
//
37zigen