結果
| 問題 | No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N) |
| コンテスト | |
| ユーザー |
lp_ql
|
| 提出日時 | 2026-07-10 21:18:33 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,084 bytes |
| 記録 | |
| コンパイル時間 | 10,204 ms |
| コンパイル使用メモリ | 192,792 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-10 21:18:45 |
| 合計ジャッジ時間 | 6,207 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
コンパイルメッセージ
warning: constant `INF` is never used
--> src/main.rs:3:7
|
3 | const INF: usize = 1 << 60;
| ^^^
|
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
warning: constant `DXY` is never used
--> src/main.rs:4:7
|
4 | const DXY: [(usize, usize); 4] = [(!0, 0), (0, 1), (1, 0), (0, !0)];
| ^^^
warning: function `yes_no` is never used
--> src/main.rs:29:4
|
29 | fn yes_no(b: bool) {
| ^^^^^^
warning: function `char_to_int` is never used
--> src/main.rs:33:4
|
33 | fn char_to_int(c: char) -> usize {
| ^^^^^^^^^^^
warning: function `int_to_char` is never used
--> src/main.rs:37:4
|
37 | fn int_to_char(i: usize) -> char {
| ^^^^^^^^^^^
warning: function `multi_solve` is never used
--> src/main.rs:41:4
|
41 | fn multi_solve() {
| ^^^^^^^^^^^
warning: struct `Compress` is never constructed
--> src/main.rs:51:8
|
51 | struct Compress<T> {
| ^^^^^^^^
warning: associated items `new`, `get`, `rev`, and `len` are never used
--> src/main.rs:56:8
|
55 | impl<T: Ord + Clone> Compress<T> {
| -------------------------------- associated items in this implementation
56 | fn new(mut v: Vec<T>) -> Self {
| ^^^
...
62 | fn get(&self, x: T) -> usize {
| ^^^
...
68 | fn rev(&self, i: usize) -> &T {
| ^^^
...
72 | fn len(&self) -> usize {
| ^^^
warning: method `chmin` is never used
--> src/main.rs:79:8
|
77 | trait ChangeMinMax {
| ------------ method in this trait
78 | fn chmax(&mut self, x: Self) -> bool;
79 | fn chmin(&mut self, x: Self) -> bool;
| ^^^^^
ソースコード
use itertools::Itertools;
use proconio::input;
const INF: usize = 1 << 60;
const DXY: [(usize, usize); 4] = [(!0, 0), (0, 1), (1, 0), (0, !0)];
fn solve() {
input! {
n: usize,
lr: [(usize, usize); n],
}
let mut ans: usize = 0;
'outer: for p in (0..n).permutations(n) {
let mut a = 0;
for &p in &p{
if lr[p].1 < a{
continue 'outer;
}
a.chmax(lr[p].0);
}
ans += 1;
}
println!("{}", ans);
}
fn main() {
solve();
// multi_solve();
}
fn yes_no(b: bool) {
println!("{}", if b { "Yes" } else { "No" });
}
fn char_to_int(c: char) -> usize {
(c as u8 - b'a') as usize
}
fn int_to_char(i: usize) -> char {
(b'a' + i as u8) as char
}
fn multi_solve() {
input! {
t: usize,
}
for _ in 0..t {
solve();
}
}
#[derive(Clone, Debug)]
struct Compress<T> {
vals: Vec<T>,
}
impl<T: Ord + Clone> Compress<T> {
fn new(mut v: Vec<T>) -> Self {
v.sort();
v.dedup();
Self { vals: v }
}
fn get(&self, x: T) -> usize {
self.vals
.binary_search(&x)
.unwrap_or_else(|_| panic!("not in compress"))
}
fn rev(&self, i: usize) -> &T {
&self.vals[i]
}
fn len(&self) -> usize {
self.vals.len()
}
}
trait ChangeMinMax {
fn chmax(&mut self, x: Self) -> bool;
fn chmin(&mut self, x: Self) -> bool;
}
impl<T: PartialOrd> ChangeMinMax for T {
fn chmax(&mut self, x: Self) -> bool {
if *self < x {
*self = x;
true
} else {
false
}
}
fn chmin(&mut self, x: Self) -> bool {
if *self > x {
*self = x;
true
} else {
false
}
}
}
#[macro_export]
macro_rules! vec2 {
($n: expr, $m: expr, $val: expr) => {
vec![vec![$val; $m]; $n]
};
}
#[macro_export]
macro_rules! vec3 {
($n: expr, $m: expr, $l: expr, $val: expr) => {
vec![vec![vec![$val; $m]; $n]; $l]
};
}
lp_ql