結果

問題 No.808 Kaiten Sushi?
ユーザー tails
提出日時 2021-03-04 18:48:45
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 883 bytes
コンパイル時間 1,071 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-05 05:58:20
合計ジャッジ時間 3,682 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 56
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:52:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   52 |         printf("%ld\n", ans);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | // marupakuri of: https://yukicoder.me/submissions/327798
main.c:52:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   52 |         printf("%ld\n", ans);
      |         ^~~~~~
main.c:52:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #
プレゼンテーションモードにする

// marupakuri of: https://yukicoder.me/submissions/327798
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char*mmap();
#define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
int x[100001],y[100001];
int main() {
char*rp=mmap(0l,1l<<28,1,2,0,0ll);
RD(N);
RD(L);
for (int i = 0;i != N;++i) {
RD(xi); x[i]=xi;
}
x[N] = L;
for (int i = 0;i != N;++i) {
RD(yi); y[i]=yi;
}
y[N] = L;
int count = 0, max = 0, min = 0;
int *xitr = x, *yitr = y;
int last;
for (int i = 0;i != N * 2;++i) {
if (*xitr < *yitr) {
++count;
if (max <= count) {
max = count;
last = *yitr;
}
++xitr;
}
else {
--count;
if (count <= min) {
min = count;
}
++yitr;
}
}
int diff = max - min;
long ans;
if (max == 0) {
ans = (long)L*diff + y[0];
}
else {
ans = (long)L*diff - (L - last);
}
printf("%ld\n", ans);
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0