結果
問題 | No.607 開通777年記念 |
ユーザー |
![]() |
提出日時 | 2021-01-14 21:09:57 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 1,273 bytes |
コンパイル時間 | 494 ms |
コンパイル使用メモリ | 30,464 KB |
実行使用メモリ | 9,984 KB |
最終ジャッジ日時 | 2024-11-24 14:36:19 |
合計ジャッジ時間 | 1,399 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <stdio.h>#include <stdlib.h>#include <sys/mman.h>// clang-format off#define RD(v) int v=0;{int _c,sign=0;for(;;){if(*rp=='-'){sign=1;rp++;}else{_c=*rp++-48;if(_c>=0)v=v*10+_c;else break;}}if(sign)v=-v;} //// clang-format onint a[1000 * 1000];int b[1001];#define TARGET 777int main() {char *rp = (char *)mmap(0l, 1l << 28, 1, 2, 0, 0ll);RD(n) RD(m);int *rap = a;int *nm = rap + n * m;while (rap < nm) {RD(t);*rap++ = t;}// b[n] = 1000000000 + 9;int *ap = a;do {int *bp = b;do {*bp++ += *ap++;} while (bp - b < n);// for (int j = 0; j < n; ++j) printf("%d ", b[j]);// printf("\n");int *left = b;int *right = b;int sm = 0;do {if ((sm += *right++) == TARGET) {printf("YES");exit(0);} else if (sm > TARGET) {do {sm -= *left++;} while (sm > TARGET);if (sm == TARGET) {printf("YES");exit(0);}}} while (right < bp);} while (ap < rap);printf("NO");exit(0);return 0; //}