結果
| 問題 |
No.3067 +10 Seconds Clock
|
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2025-03-21 21:35:37 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 536 bytes |
| コンパイル時間 | 943 ms |
| コンパイル使用メモリ | 24,832 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-21 21:35:41 |
| 合計ジャッジ時間 | 2,137 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:27: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 2 has type ‘int *’ [-Wformat=]
9 | scanf("%lld", &t[i]);
| ~~~^ ~~~~~
| | |
| | int *
| long long int *
| %d
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d %d", &n, &T);
| ^~~~~~~~~~~~~~~~~~~~~~
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lld", &t[i]);
| ^~~~~~~~~~~~~~~~~~~~
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d", &k);
| ^~~~~~~~~~~~~~~
main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d", &x[i]);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int t[200005], x[200005];
int main()
{
int n, T;
scanf("%d %d", &n, &T);
int i, j;
for (i = 0; i < n - 1; i++)
scanf("%lld", &t[i]);
int k;
scanf("%d", &k);
for (i = 0; i < k; i++)
{
scanf("%d", &x[i]);
x[i]--;
}
x[k] = n + 1;
int ans = 0, cnt = 0;
for (i = 0, j = 0; i < n - 1; i++)
{
if (x[j] == i)
{
cnt++;
j++;
}
T -= t[i];
while (T <= 0 && cnt>0)
{
T += 10;
cnt--;
ans++;
}
if (T <= 0)
{
printf("-1\n");
return 0;
}
}
printf("%d\n", ans);
return 0;
}
pengin_2000