結果
| 問題 |
No.2961 Shiny Monster Master
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-19 01:26:27 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 794 bytes |
| コンパイル時間 | 324 ms |
| コンパイル使用メモリ | 7,072 KB |
| 実行使用メモリ | 57,224 KB |
| 最終ジャッジ日時 | 2024-11-19 01:26:42 |
| 合計ジャッジ時間 | 12,936 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 73 |
ソースコード
function Main(INPUT){
const input=INPUT.split("\n");
const [R,N] = input[0].split(" ").map(_=>parseInt(_));
const count = input[1].split(" ").map(_=>parseInt(_));
const Q=parseInt(input[2]);
for(let i=0;i<Q;i++){
let [l,r]=input[3+i].split(" ").map(_=>parseInt(_));
l--;
let [cl,cr]=[l%R, r%R];
let[lok,lng,rok,rng]=[-1,N,-1,N];
while(lng>lok+1){
let mid = Math.floor((lng+lok)/2);
if(count[mid]<=cl){
lok=mid;
}
else{
lng=mid;
}
}
while(rng>rok+1){
let mid = Math.floor((rng+rok)/2);
if(count[mid]<=cr){
rok=mid;
}
else{
rng=mid;
}
}
console.log(N*Math.floor(r/R)+rng - N*Math.floor(l/R)-lng);
}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));