結果

問題 No.387 ハンコ
ユーザー takayuta1999takayuta1999
提出日時 2016-07-02 23:04:06
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 566 ms / 5,000 ms
コード長 1,080 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 43,316 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-04-20 06:20:42
合計ジャッジ時間 5,800 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 548 ms
7,040 KB
testcase_01 AC 566 ms
7,040 KB
testcase_02 AC 534 ms
5,632 KB
testcase_03 AC 540 ms
5,760 KB
testcase_04 AC 102 ms
5,888 KB
testcase_05 AC 228 ms
6,912 KB
testcase_06 AC 380 ms
7,036 KB
testcase_07 AC 533 ms
6,016 KB
testcase_08 AC 533 ms
5,760 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:23:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |                 scanf("%d",&a);a--;
      |                 ~~~~~^~~~~~~~~
main.cpp:29:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |                 scanf("%d",&b);
      |                 ~~~~~^~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 100005
#define MX 60

using namespace std;
typedef long long int ll;

ll ans[(2*SIZE)/MX+5],bit[SIZE/MX+5];
ll now[(2*SIZE)/MX+5];
vector <int> vec[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int a;
		scanf("%d",&a);a--;
		vec[a].push_back(i);
	}
	for(int i=0;i<n;i++)
	{
		int b;
		scanf("%d",&b);
		if(b==1) bit[i/MX]|=1LL<<(i%MX);
	}
	int sz=(n-1)/MX+1;
	int mx=(2*n-1)/MX+1;
	for(int i=0;i<SIZE;i++)
	{
		for(int j=0;j<mx;j++) now[j]=0;
		for(int j=0;j<vec[i].size();j++)
		{
			int c=vec[i][j];
			int s=c/MX,t=c%MX;
			for(int k=0;k<sz;k++)
			{
				ll wt=bit[k];
				//printf("%d %lld : %lld\n",t,wt,wt&((1LL<<(MX-t))-1));
				now[k+s]|=(wt&((1LL<<(MX-t))-1))<<t;
				now[k+s+1]|=wt>>(MX-t);
			}
		}
		for(int j=0;j<mx;j++) ans[j]^=now[j];/*
		if(i<3)
		{
			for(int j=0;j<mx;j++) printf("%lld  ",now[j]);
			puts("");
		}*/
	}
	for(int i=0;i<2*n-1;i++)
	{
		if((ans[i/MX]>>(i%MX))&1) puts("ODD");
		else puts("EVEN");
	}
	return 0;
}
0