結果
| 問題 |
No.387 ハンコ
|
| コンテスト | |
| ユーザー |
takayuta1999
|
| 提出日時 | 2016-07-02 23:04:06 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 592 ms / 5,000 ms |
| コード長 | 1,080 bytes |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 43,320 KB |
| 実行使用メモリ | 7,168 KB |
| 最終ジャッジ日時 | 2024-10-12 01:26:57 |
| 合計ジャッジ時間 | 6,250 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
コンパイルメッセージ
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);
| ~~~~~^~~~~~~~~
ソースコード
#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;
}
takayuta1999