結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2018-06-06 00:00:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 760 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 32,256 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-06-30 10:10:41 |
合計ジャッジ時間 | 3,718 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | TLE * 1 -- * 20 |
ソースコード
#include <stdio.h> #include <stdlib.h> int func(const void *a, const void *b){ return *(int *)a - *(int *)b; } int main(){ int N, i; int a[1000], b[1000], width[1000]; int cnt = 0, sub; scanf("%d\n", &N); for(i = 0; i < N; i++){ scanf("%d %d\n", &a[i], &b[i]); width[i] = a[i] + 4*b[i]; } qsort(width, N, sizeof(int), func); for(i = 0; i < N; i++){ sub = width[N - 1] - width[i]; if(sub > 0){ while(1){ sub -= 2; cnt++; if(sub == 0) break; if(sub < 0){ printf("-1\n"); return 0; } } } } printf("%d\n", cnt); return 0; }