Submission #1133647

#TimeUsernameProblemLanguageResultExecution timeMemory
1133647LuvidiMosaic (IOI24_mosaic)C++20
22 / 100
1084 ms2162688 KiB
#include "mosaic.h" #include <bits/stdc++.h> using namespace std; std::vector<long long> mosaic(std::vector<int> x, std::vector<int> y, std::vector<int> t, std::vector<int> b, std::vector<int> l, std::vector<int> r) { int n=x.size(); long long a[n+1][n+1]; memset(a,0,sizeof(a)); for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i==1)a[i][j]=x[j-1]; else if(j==1)a[i][j]=y[i-1]; else{ a[i][j]=!a[i-1][j]&&!a[i][j-1]; } } } for(int i=4;i<=n;i++){ for(int j=4;j<=n;j++){ assert(a[i][j]==a[i-1][j-1]); } } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1]; } } int q=t.size(); vector<long long> ans(q); for(int i=0;i<q;i++){ r[i]++; b[i]++; ans[i]=a[b[i]][r[i]]+a[t[i]][l[i]]-a[t[i]][r[i]]-a[b[i]][l[i]]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...