結果

問題 No.2662 Installing Cell Towers
ユーザー 👑 tails
提出日時 2024-03-06 16:09:29
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 756 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 270 ms
コンパイル使用メモリ 21,832 KB
最終ジャッジ日時 2026-02-23 12:37:29
合計ジャッジ時間 788 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function ‘main’:
main.c:21:17: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
   21 |                 for(long m=rd();m--;){
      |                 ^~~
main.c:21:17: note: use option ‘-std=c99’, ‘-std=gnu99’, ‘-std=c11’ or ‘-std=gnu11’ to compile your code
main.c:38:22: error: expected ‘;’ before ‘x’
   38 |                 rrep(x,n){
      |                      ^
main.c:7:33: note: in definition of macro ‘rrep’
    7 | #define rrep(v,e) for(typeof(e) v=e;v--;)
      |                                 ^
main.c:38:22: error: ‘x’ undeclared (first use in this function)
   38 |                 rrep(x,n){
      |                      ^
main.c:7:37: note: in definition of macro ‘rrep’
    7 | #define rrep(v,e) for(typeof(e) v=e;v--;)
      |                                     ^
main.c:38:22: note: each undeclared identifier is reported only once for each function it appears in
   38 |                 rrep(x,n){
      |                      ^
main.c:7:37: note: in definition of macro ‘rrep’
    7 | #define rrep(v,e) for(typeof(e) v=e;v--;)
      |                                     ^

ソースコード

diff #
raw source code

#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() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) ({ulong _z=v;do*--wp=_z%10+48;while(_z/=10);})
#define rrep(v,e) for(typeof(e) v=e;v--;)

typedef unsigned long ulong;

char wbuf[1<<25];
long c[100000];

int main(){
	long n;
	long a=0;
	long b=0;
	{
		rd_init();
		n=rd();
		for(long m=rd();m--;){
			long p=rd()-1;
			long q=rd();
			if(p-q>=0){
				c[p-q]+=1;
			}
			c[p]+=-2;
			if(p+q<n){
				c[p+q]+=1;
			}else{
				b+=1;
				a+=p+q-n+1;
			}
		}
	}
	{
		char*wp=wbuf+sizeof wbuf;
		rrep(x,n){
			*--wp=' ';
			wt(a);
			a+=b+=c[x];
		}
		write(1,wp,wbuf+sizeof wbuf-wp);
	}
	_exit(0);
}
0