# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
34985 |
2017-11-17T09:09:56 Z |
nad312 |
스파이 (JOI13_spy) |
C++14 |
|
0 ms |
0 KB |
\#include<bits/stdc++.h>
using namespace std;
typedef int lli;
lli a, b, c, d, h, chia=63;
long long int x[2009][7820]={}, y[2009][7820]={};
vector<lli> Dx[2009], Dy[2009];
lli next()
{
register char ch=getchar();
lli l=0;
while(ch<'0'||ch>'9')
{
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
l=l*10+ch-'0';
ch=getchar();
}
return l;
}
void DSFx(lli u, lli k)
{
x[u][k/chia]=x[u][k/chia]|((long long int)1<<(k%chia));
for(auto v: Dx[u])
{
DSFx(v, k);
}
}
void DSFy(lli u, lli k)
{
y[u][k/chia]=y[u][k/chia]|((long long int)1<<(k%chia));
for(auto v: Dy[u])
{
DSFy(v, k);
}
}
void Inp()
{
a=next();
b=next();
for(int i=1;i<=a;i++)
{
c=next();
d=next();
Dx[c].push_back(i);
Dy[d].push_back(i);
}
for(int i=1;i<=b;i++)
{
c=next();
d=next();
DSFx(c, i);
DSFy(d, i);
}
}
void Solve()
{
h=b/chia;
for(int i=1;i<=a;i++)
{
d=0;
for(int j=0;j<=h;j++)
{
c=(x[i][j]&y[i][j]);
d=d+__builtin_popcount(c);
}
cout<<d<<'\n';
}
}
int main()
{
//freopen("test.inp","r",stdin);
Inp();
Solve();
}
Compilation message
spy.cpp:1:1: error: stray '\' in program
\#include<bits/stdc++.h>
^
spy.cpp:1:2: error: stray '#' in program
\#include<bits/stdc++.h>
^
spy.cpp:1:3: error: 'include' does not name a type
\#include<bits/stdc++.h>
^
spy.cpp:6:1: error: 'vector' does not name a type
vector<lli> Dx[2009], Dy[2009];
^
spy.cpp: In function 'lli next()':
spy.cpp:9:27: error: 'getchar' was not declared in this scope
register char ch=getchar();
^
spy.cpp: In function 'void DSFx(lli, lli)':
spy.cpp:25:14: error: 'Dx' was not declared in this scope
for(auto v: Dx[u])
^
spy.cpp: In function 'void DSFy(lli, lli)':
spy.cpp:33:14: error: 'Dy' was not declared in this scope
for(auto v: Dy[u])
^
spy.cpp: In function 'void Inp()':
spy.cpp:46:3: error: 'Dx' was not declared in this scope
Dx[c].push_back(i);
^
spy.cpp:47:3: error: 'Dy' was not declared in this scope
Dy[d].push_back(i);
^
spy.cpp: In function 'void Solve()':
spy.cpp:68:3: error: 'cout' was not declared in this scope
cout<<d<<'\n';
^