QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#876213 | #5713. Eggscavation | sdds | Compile Error | / | / | C++14 | 2.6kb | 2025-01-30 18:38:23 | 2025-01-30 18:38:30 |
Judging History
This is the latest submission verdict.
- [2025-01-30 18:38:30]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-30 18:38:23]
- Submitted
answer
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <iomanip>
#include <queue>
#include <map>
#define ll int
#define maxn 2507
using namespace std;
ll n , K , m , T , q[maxn][maxn] , w[maxn][maxn] , fa[maxn][maxn] , X[maxn] , Y[maxn];
ll c[200000];
ll find( ll s1 , ll s2 ) { return ( fa[s1][s2] == s2 ? s2 : fa[s1][s2] = find( s1 , fa[s1][s2] ) ); }
void add( ll s1 , ll w )
{
if( s1 == 0 ) return;
while( s1 <= m ) {
c[s1] += w; s1 += ( s1 & -s1 );
}
}
void del( ll x , ll s1 , ll s2 )
{
int now = find( x , s1 );
while( now <= s2 ) {
add( w[x][now] , -1 ); fa[x][now] = now + 1; now = find( x , now );
}
}
ll ask( ll s1 )
{
ll sum = 0;
while( s1 ) {
sum += c[s1]; s1 -= ( s1 & -s1 );
}
return sum;
}
int main()
{
ios :: sync_with_stdio( false );
cin.tie( 0 );
cin >> n >> K >> m; if( n > 40 ) return;
for( int i = 1 ; i <= m ; ++i ) {
ll tmp; cin >> tmp;
for( int j = 0 ; j < tmp ; ++j ) {
cin >> X[j] >> Y[j];
}
for( int j = 1 ; j < ( 1 << tmp ) ; ++j ) {
ll mnx , mxx , mny , mxy; mnx = mny = 1; mxx = mxy = n; ll sum = 0;
for( int k = 0 ; k < tmp ; ++k )
if( j & (1<<k) ) {
sum ++; mnx = max( mnx , X[k] ); mxx = min( mxx , X[k] + K - 1 );
mny = max( mny , Y[k] ); mxy = min( mxy , Y[k] + K - 1 );
}
sum = ( sum % 2 ? 1 : -1 );
if( mnx <= mxx && mny <= mxy ) {
q[mnx][mny] += sum; q[mxx + 1][mny] -= sum; q[mnx][mxy + 1] -= sum;
q[mxx + 1][mxy + 1] += sum;
}
}
for( int j = 1 ; j <= n ; ++j )
for( int k = 1 ; k <= n ; ++k )
q[j][k] += q[j - 1][k] + q[j][k - 1] - q[j - 1][k - 1];
for( int j = 1 ; j <= n ; ++j )
for( int k = 1 ; k <= n ; ++k ) {
if( q[j][k] > 1 ) cout << 0/0;
w[j][k] += q[j][k];
q[j][k] = 0;
}
}
for( int j = 1 ; j <= n ; ++j )
for( int k = 1 ; k <= n ; ++k )
q[j][k] += q[j - 1][k] + q[j][k - 1] - q[j - 1][k - 1];
for( int i = 1 ; i <= n ; ++i ) for( int j = 1 ; j <= n + 1 ; ++j ) fa[i][j] = j;//w[i][j] = q[i][j];
for( int i = K ; i <= n ; ++i ) for( int j = K ; j <= n ; ++j ) if( w[i][j] ) add( w[i][j] , 1 );
cin >> T;
while( T -- ) {
ll opt , x , y;
cin >> opt;
if( opt == 1 ) {
cin >> x >> y;
for( int i = x ; i <= min( n , x + K - 1 ) ; ++i )
del( i , y , min( n , y + K - 1 ) );
}else {
ll sum= 0; cin>> x;
if( x > m ) {
sum = 0;
}else sum = ask( m ) - ask( x - 1 );
cout << fixed << setprecision( 5 ) << (double)sum / (double)( (n-K+1)*(n-K+1)) <<"\n";
}
}
return 0;
}
详细
answer.code: In function ‘int main()’: answer.code:51:42: error: return-statement with no value, in function returning ‘int’ [-fpermissive] 51 | cin >> n >> K >> m; if( n > 40 ) return; | ^~~~~~ answer.code:75:52: warning: division by zero [-Wdiv-by-zero] 75 | if( q[j][k] > 1 ) cout << 0/0; | ~^~