# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
998284 | doducanh | Osmosmjerka (COCI17_osmosmjerka) | C++14 | 1785 ms | 94852 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod=(1ll<<(61)-1);
int sub[505][505][31];
string s[505];
int n,m,k;
map<int,int>c;
int nn,mm;
void xuly(int dx,int dy)
{
int base=31;
for(int lo=1;lo<=30;lo++){
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
int ni=(i+dx*(1ll<<(lo-1))+nn)%n;
int nj=(j+dy*(1ll<<(lo-1))+mm)%m;
if(ni==0)ni=n;if(nj==0)nj=m;
sub[i][j][lo]=(sub[i][j][lo-1]*base%mod+sub[ni][nj][lo-1])%mod;
}
}
base=(base*base)%mod;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
int x=i,y=j;
int base=31;
int res=0;
for(int lo=30;lo>=0;lo--){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |