結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-05 14:58:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 5,000 ms |
| コード長 | 1,796 bytes |
| コンパイル時間 | 1,846 ms |
| コンパイル使用メモリ | 170,324 KB |
| 実行使用メモリ | 35,304 KB |
| 最終ジャッジ日時 | 2024-12-22 10:52:59 |
| 合計ジャッジ時間 | 4,444 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< int, int > pii;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< ll > vl;
typedef vector< vl > vvl;
typedef vector< pii > vp;
typedef vector< vp > vvp;
typedef vector< string > vs;
typedef vector< double > vd;
typedef vector< vd > vvd;
template< class T1, class T2 >
int upmin( T1 &x, T2 v ){
if( x > v ){
x = v;
return 1;
}
return 0;
}
template< class T1, class T2 >
int upmax( T1 &x, T2 v ){
if( x < v ){
x = v;
return 1;
}
return 0;
}
const int INF = 0x3f3f3f3f;
int N;
vi X, Y;
void init(){
cin >> N;
X = Y = vi( N );
for( int i = 0; i < N; ++i )
cin >> X[ i ] >> Y[ i ];
}
int cx[ 2000 + 1 ][ 2000 + 1 ];
int cy[ 2000 + 1 ][ 2000 + 1 ];
int eu_dis2( int x, int y, int a, int b ){
int dtx = x - a;
int dty = y - b;
return dtx * dtx + dty * dty;
}
void preprocess(){
memset( cx, -1, sizeof( cx ) );
for( int i = 0; i < N; ++i ){
int x = X[ i ], y = Y[ i ];
if( cx[ x / 10 ][ y / 10 ] != -1 ) continue;
int ng = 0;
for( int dx = -2; dx <= 2; ++dx ){
for( int dy = -2; dy <= 2; ++dy ){
int nx = x / 10 + dx;
int ny = y / 10 + dy;
if( nx < 0 or nx > 2000 or ny < 0 or ny > 2000 ) continue;
if( cx[ nx ][ ny ] == -1 ) continue;
if( eu_dis2( x, y, cx[ nx ][ ny ], cy[ nx ][ ny ] ) >= 400 ) continue;
ng = 1;
}
}
if( ng ) continue;
cx[ x / 10 ][ y / 10 ] = x;
cy[ x / 10 ][ y / 10 ] = y;
}
}
void solve(){
int ans = 0;
for( int i = 0; i <= 2000; ++i )
for( int j = 0; j <= 2000; ++j )
ans += cx[ i ][ j ] != -1;
cout << ans << endl;
}
signed main(){
ios::sync_with_stdio( 0 );
init();
preprocess();
solve();
return 0;
}