結果

問題 No.1795 AtCoder Heuristic Rating coloring
ユーザー tailstails
提出日時 2021-12-24 11:16:18
言語 C++11
(gcc 11.4.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 881 bytes
コンパイル時間 641 ms
コンパイル使用メモリ 51,884 KB
実行使用メモリ 16,928 KB
最終ジャッジ日時 2023-10-20 07:53:26
合計ジャッジ時間 5,104 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 1 ms
4,348 KB
testcase_32 AC 21 ms
7,456 KB
testcase_33 AC 14 ms
6,380 KB
testcase_34 AC 34 ms
11,312 KB
testcase_35 AC 28 ms
8,516 KB
testcase_36 AC 35 ms
11,616 KB
testcase_37 AC 17 ms
6,752 KB
testcase_38 AC 15 ms
6,880 KB
testcase_39 AC 35 ms
11,808 KB
testcase_40 AC 23 ms
7,896 KB
testcase_41 AC 33 ms
11,372 KB
testcase_42 AC 19 ms
7,420 KB
testcase_43 AC 22 ms
7,972 KB
testcase_44 AC 28 ms
11,144 KB
testcase_45 AC 20 ms
7,468 KB
testcase_46 AC 37 ms
12,128 KB
testcase_47 AC 9 ms
4,916 KB
testcase_48 AC 19 ms
7,656 KB
testcase_49 AC 42 ms
12,312 KB
testcase_50 AC 20 ms
6,964 KB
testcase_51 AC 16 ms
6,624 KB
testcase_52 AC 47 ms
13,664 KB
testcase_53 AC 49 ms
13,640 KB
testcase_54 AC 62 ms
16,928 KB
testcase_55 AC 63 ms
16,928 KB
testcase_56 AC 69 ms
16,928 KB
testcase_57 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |         ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

#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);
}
0