結果
問題 | No.1795 AtCoder Heuristic Rating coloring |
ユーザー |
![]() |
提出日時 | 2021-12-24 11:16:18 |
言語 | C++11 (gcc 13.3.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 881 bytes |
コンパイル時間 | 1,163 ms |
コンパイル使用メモリ | 51,448 KB |
実行使用メモリ | 16,256 KB |
最終ジャッジ日時 | 2024-09-20 03:22:54 |
合計ジャッジ時間 | 4,283 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 53 RE * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:49:14: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 49 | write(1,wbuf,wp-wbuf); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #include <sys/mman.h> #include <stdint.h> #include <unistd.h> #include <cstring> #include <map> using namespace std; char wbuf[1<<25]; struct valt{ unsigned long s[3]; long len; }; using keyt=unsigned __int128; int main(){ char*rp=static_cast<char*>(mmap(0,1<<25,1,2,0,0)); while(*rp++!=10); map<keyt,valt> h; while(*rp){ int d=16; keyt k=0; char*p=rp; long c; while(c=*p++,c!=32){ k|=keyt(c)<<(--d<<3); } while(c=*p++,c!=10){ } valt&v=h[k]; v.s[0]=((unsigned long*)rp)[0]; v.s[1]=((unsigned long*)rp)[1]; v.s[2]=((unsigned long*)rp)[2]; v.len=p-rp; rp=p; } char*wp=wbuf; for(auto&&t:h){ ((unsigned long*)wp)[0]=t.second.s[0]; ((unsigned long*)wp)[1]=t.second.s[1]; ((unsigned long*)wp)[2]=t.second.s[2]; wp+=t.second.len; } *wp=0; write(1,wbuf,wp-wbuf); _exit(0); }