結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
![]() |
提出日時 | 2025-09-06 13:22:23 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 323 ms |
コンパイル使用メモリ | 27,468 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-09-06 13:22:26 |
合計ジャッジ時間 | 1,240 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:39:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 39 | scanf("%d", &n); | ^~~~~~~~~~~~~~~ main.c:42:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 42 | scanf("%d %d", &l[i], &r[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int n; int l[8], r[8]; int ans; void check(int p[]) { int x = -1, i; for (i = 0; i < n; i++) { if (x < l[p[i]]) x = l[p[i]]; else if (x > r[p[i]]) return; } ans++; return; } void make(int a[], int aa, int b[], int bb) { if (bb == 0) { check(a); return; } int i, c[8], j; for (i = 0; i < bb; i++) { for (j = 0; j < i; j++) c[j] = b[j]; for (j = i + 1; j < bb; j++) c[j - 1] = b[j]; a[aa] = b[i]; make(a, aa + 1, c, bb - 1); } return; } int main() { scanf("%d", &n); int i; for (i = 0; i < n; i++) scanf("%d %d", &l[i], &r[i]); ans = 0; int a[8], b[8]; for (i = 0; i < n; i++) b[i] = i; make(a, 0, b, n); printf("%d\n", ans); return 0; }