Submission #379162

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3791622021-03-17 11:32:49ThistleRectangles (IOI19_rect)C++14
50 / 100
5042 ms49516 KiB
#include "rect.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using H=pair<ll, ll>;
using vi=vector<ll>;
#define vec vector
#define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) rng((i),(0),(n))
#define fs first
#define sc second
#define all(a) (a).begin(),(a).end()
#define siz(a) ll((a).size())
class sptable{
int n;
vi lgt;
vec<vi> dat;
public:
sptable(vec<int> v){
n=siz(v);
lgt.assign(n+1,0);
for(int i=2;i<=n;i++) lgt[i]=lgt[i>>1]+1;
dat.assign(lgt[n]+1,vi(n));
rep(i,n) dat[0][i]=v[i];
rng(i,0,lgt[n]){
for(int j=0;j+(1<<(i+1))<=n;j++){
dat[i+1][j]=max(dat[i][j],dat[i][j+(1<<i)]);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

rect.cpp: In constructor 'sptable::sptable(std::vector<int>)':
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:26:3: note: in expansion of macro 'rep'
   26 |   rep(i,n) dat[0][i]=v[i];
      |   ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:27:3: note: in expansion of macro 'rng'
   27 |   rng(i,0,lgt[n]){
      |   ^~~
rect.cpp: In function 'll gen()':
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:44:2: note: in expansion of macro 'rep'
   44 |  rep(i,n)rep(j,m) v[i][j]=rnd()%5;
      |  ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:44:10: note: in expansion of macro 'rep'
   44 |  rep(i,n)rep(j,m) v[i][j]=rnd()%5;
      |          ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:46:2: note: in expansion of macro 'rep'
   46 |  rep(i,n-2)rep(j,m-2){
      |  ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:46:12: note: in expansion of macro 'rep'
   46 |  rep(i,n-2)rep(j,m-2){
      |            ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'k' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:47:3: note: in expansion of macro 'rng'
   47 |   rng(k,i+2,n)rng(t,j+2,m){
      |   ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 't' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:47:15: note: in expansion of macro 'rng'
   47 |   rng(k,i+2,n)rng(t,j+2,m){
      |               ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'x' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:49:4: note: in expansion of macro 'rng'
   49 |    rng(x,i+1,k)rng(y,j+1,t){
      |    ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'y' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:49:16: note: in expansion of macro 'rng'
   49 |    rng(x,i+1,k)rng(y,j+1,t){
      |                ^~~
rect.cpp: In function 'void check()':
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:59:2: note: in expansion of macro 'rep'
   59 |  rep(i,1000){
      |  ^~~
rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:78:3: note: in expansion of macro 'rep'
   78 |   rep(i,h)rep(j,w) mxv=max(mxv,a[i][j]);
      |   ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:78:11: note: in expansion of macro 'rep'
   78 |   rep(i,h)rep(j,w) mxv=max(mxv,a[i][j]);
      |           ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:81:3: note: in expansion of macro 'rep'
   81 |   rep(i,h)rep(j,w){
      |   ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:81:11: note: in expansion of macro 'rep'
   81 |   rep(i,h)rep(j,w){
      |           ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'z' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:97:5: note: in expansion of macro 'rep'
   97 |     rep(z,4){
      |     ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:115:4: note: in expansion of macro 'rep'
  115 |    rep(i,h-2)rep(j,w-2){
      |    ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:10:18: note: in expansion of macro 'rng'
   10 | #define rep(i,n) rng((i),(0),(n))
      |                  ^~~
rect.cpp:115:14: note: in expansion of macro 'rep'
  115 |    rep(i,h-2)rep(j,w-2){
      |              ^~~
rect.cpp:9:28: warning: unnecessary parentheses in declaration of 'k' [-Wparentheses]
    9 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
rect.cpp:119:5: note: in expansion of macro 'rng'
  119 |     rng(k,i+2,h){
      |     ^~~
#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...