Submission #867308

# Submission time Handle Problem Language Result Execution time Memory
867308 2023-10-28T06:54:41 Z Muhammad_Aneeq Nuclearia (CEOI15_nuclearia) C++17
30 / 100
1000 ms 100544 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-1,i+(((y+z-1)/z)+1));k++)
    {
      for (int l=max(0LL,j-((y+z-1)/z)+1);l<=min(w-1,j+(((y+z-1)/z)+1));l++)
      {
        a[k][l]+=max(0LL,y-z*max(abs(k-i),abs(l-j)));
      }
    }
  }
  __int128 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<<(long long)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 Correct 289 ms 98132 KB Output is correct
2 Correct 51 ms 2640 KB Output is correct
3 Correct 46 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 276 ms 98068 KB Output is correct
2 Correct 48 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 58964 KB Output is correct
2 Correct 49 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 61012 KB Output is correct
2 Correct 49 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 230 ms 100544 KB Output is correct
2 Correct 69 ms 3044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 311 ms 42068 KB Output is correct
2 Correct 49 ms 2820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 247 ms 61596 KB Output is correct
2 Correct 54 ms 2900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 272 ms 34364 KB Output is correct
2 Correct 53 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1006 ms 19800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 19804 KB Time limit exceeded
2 Halted 0 ms 0 KB -