Submission #867289

# Submission time Handle Problem Language Result Execution time Memory
867289 2023-10-28T06:08:52 Z Muhammad_Aneeq Nuclearia (CEOI15_nuclearia) C++17
0 / 100
1000 ms 61360 KB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <cmath>
using namespace std;
#define int long long
inline void solve()
{
  int h,w;
  cin>>h>>w;
  int a[h][w]={};
  int x;
  cin>>x;
  while (x--)
  {
    int i,j,y,z;
    cin>>i>>j>>y>>z;
    i--;j--;
    for (int k=max(0LL,i-((y+z-1)/z)+1);k<min(h,i+((y+z-1)/z));k++)
    {
      for (int l=max(0LL,j-((y+z-1)/z)+1);l<min(w,j+((y+z-1)/z));l++)
      {
        a[k][l]+=y-z*max(abs(k-i),abs(l-j));
      }
    }
  }
  int pre[h+1][w+1]={};
  for (int i=0;i<h;i++)
  {
    for (int j=0;j<w;j++)
    {
      pre[i+1][j+1]=pre[i+1][j]+pre[i][j+1]-pre[i][j]+a[i][j];
    }
  }
  int q;
  cin>>q;
  while (q--)
  {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int f=pre[c][d]-pre[c][b-1]-pre[a-1][d]+pre[a-1][b-1];
    long double g=(c-a+1)*(d-b+1);
    cout<<round(f/g)<<'\n';
  }
}
signed main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        solve();
}
# Verdict Execution time Memory Grader output
1 Incorrect 252 ms 58924 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 236 ms 58968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 84 ms 39508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 40468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 271 ms 61360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 366 ms 26224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 268 ms 41772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 314 ms 22732 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1030 ms 19936 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -