結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー tailstails
提出日時 2023-05-19 22:40:09
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 945 bytes
コンパイル時間 1,721 ms
コンパイル使用メモリ 27,468 KB
実行使用メモリ 5,892 KB
最終ジャッジ日時 2023-08-23 00:34:37
合計ジャッジ時間 4,034 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 7 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 6 ms
4,380 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 4 ms
4,376 KB
testcase_15 AC 8 ms
4,704 KB
testcase_16 AC 8 ms
4,616 KB
testcase_17 AC 10 ms
5,892 KB
testcase_18 AC 11 ms
5,804 KB
testcase_19 AC 11 ms
5,888 KB
testcase_20 AC 11 ms
5,804 KB
testcase_21 AC 11 ms
5,836 KB
testcase_22 AC 11 ms
5,832 KB
testcase_23 AC 10 ms
5,844 KB
testcase_24 AC 10 ms
5,808 KB
testcase_25 AC 10 ms
5,856 KB
testcase_26 AC 11 ms
5,768 KB
testcase_27 AC 4 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:38:2: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  write(1,wbuf,wp-wbuf);
  ^~~~~
main.c:39:2: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  _exit(0);
  ^~~~~
main.c:39:2: warning: incompatible implicit declaration of built-in function ‘_exit’

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd_skip() while(*rp++>=48)
#define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define WTHI(v) {ulong _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(ulong*)wp=_d;wp+=_n;}
#define WTLO(v) {ulong _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(ulong*)wp=_d;wp+=8;}
#define wt(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);}
#define rep(v,e) for(typeof(e) v=0;v<e;++v)

typedef unsigned long ulong;
char wbuf[1<<25];
long a[100000];

int main(){
	rd_init();
	rd_skip();
	long m=rd();
	long z=0;
	rep(i,m){
		a[i]=rd();
		z+=a[i]*a[i];
	}
	rd_skip();
	char*wp=wbuf;
	while(*rp){
		long c=rd()-1;
		long k=rd();
		long d=rd()-1;
		z-=a[c]*a[c]+a[d]*a[d];
		a[c]-=k;
		a[d]+=k;
		z+=a[c]*a[c]+a[d]*a[d];
		wt(z);
		*wp++='\n';
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0