QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#832648#504. ChessboardI_love_Banu#Compile Error//C++141.8kb2024-12-26 01:47:462024-12-26 01:47:46

Judging History

你现在查看的是最新测评结果

  • [2024-12-26 01:47:46]
  • 评测
  • [2024-12-26 01:47:46]
  • 提交

answer

#include"bits/stdc++.h"
using namespace std;
#define FOR(i,a,b)for(int i=(a);i<(b);i++)
#define F0R(i,a)FOR(i,0,a)
#define ROF(i,a,b)for(int i=(b)-1;(a)<=i;i--)
#define R0F(i,a)ROF(i,0,a)
#define rep(a)F0R(_,a)
#define each(a,x)for(auto&a:x)
#define all(a)begin(a),end(a)
#define sz(x)int(size(x))
#define lla(x)rbegin(x),rend(x)
#define SUM(a)accumulate(all(a),0ll)
#define SUMM(a,b)accumulate(a,a+b,0ll)
#define MAX(a)(*max_element(all(a)))
#define MAXX(a,b)(*max_element(a,a+b))
#define MIN(a)(*min_element(all(a)))
#define MINN(a,b)(*min_element(a,a+b))
#define con const int
#ifdef LOCAL
#define print(x)cout<<x
#else
#define print(x)
#endif
using ld=long double;
using ll=long long;
using str=string;
template<class T,class U>ifstream&operator>>(istream&in,pair<T,U>a){return in>>a.first>>a.second;}
void fileset(str a){freopen((a+".in").c_str(),"r",stdin);freopen((a+".out").c_str(),"w",stdout);}

con mxN = 1e5 + 5;

vector<int> dv;

ll cnt[mxN][2];

int main(){
    int N, K;
    cin >> N >> K;

    FOR(i, 1, N){
	if (0 == N % i){
	    int x = N / i;

	    if (x & 1){
		cnt[sz(dv)][0] = 1ll * i * N * (x / 2) + 1ll * i * i * (x / 2);
		cnt[sz(dv)][1] = cnt[sz(dv)][0] + 1ll * i * i;
	    } else {
		cnt[sz(dv)][0] = cnt[sz(dv)][1] = 1ll * N * N / 2;
	    }

	    dv.push_back(i);
	}
    }

    rep(K){
	int X1, Y1, X2, Y2;
	cin >> Y1 >> X1 >> Y2 >> X2;

	F0R(i, sz(dv)){
	    int j = dv[i];
	    int x = (Y1 - 1) / j + 1;
	    int y = (X1 - 1) / j + 1;

	    if (x & 1){
		if (y & 1) cnt[i][1] --, cnt[i][0] ++;
		else cnt[i][0] --, cnt[i][1] ++;
	    } else {
		if (y & 1) cnt[i][1] ++, cnt[i][0] --;
		else cnt[i][0] ++, cnt[i][1] --;
	    }
	}
    }

    ll ans = 1ll * N * N;

    F0R(i, sz(dv)){
	ans = min(ans, cnt[i][0]);
	ans = min(ans, cnt[i][1]);
    }

    cout << ans << endl;
}

Details

answer.code: In function ‘int main()’:
answer.code:10:18: error: ‘size’ was not declared in this scope
   10 | #define sz(x)int(size(x))
      |                  ^~~~
answer.code:45:21: note: in expansion of macro ‘sz’
   45 |                 cnt[sz(dv)][0] = 1ll * i * N * (x / 2) + 1ll * i * i * (x / 2);
      |                     ^~
answer.code:10:18: error: ‘size’ was not declared in this scope
   10 | #define sz(x)int(size(x))
      |                  ^~~~
answer.code:48:21: note: in expansion of macro ‘sz’
   48 |                 cnt[sz(dv)][0] = cnt[sz(dv)][1] = 1ll * N * N / 2;
      |                     ^~
answer.code:10:18: error: ‘size’ was not declared in this scope
   10 | #define sz(x)int(size(x))
      |                  ^~~~
answer.code:3:36: note: in definition of macro ‘FOR’
    3 | #define FOR(i,a,b)for(int i=(a);i<(b);i++)
      |                                    ^
answer.code:59:9: note: in expansion of macro ‘F0R’
   59 |         F0R(i, sz(dv)){
      |         ^~~
answer.code:59:16: note: in expansion of macro ‘sz’
   59 |         F0R(i, sz(dv)){
      |                ^~
answer.code:10:18: error: ‘size’ was not declared in this scope
   10 | #define sz(x)int(size(x))
      |                  ^~~~
answer.code:3:36: note: in definition of macro ‘FOR’
    3 | #define FOR(i,a,b)for(int i=(a);i<(b);i++)
      |                                    ^
answer.code:76:5: note: in expansion of macro ‘F0R’
   76 |     F0R(i, sz(dv)){
      |     ^~~
answer.code:76:12: note: in expansion of macro ‘sz’
   76 |     F0R(i, sz(dv)){
      |            ^~
answer.code: In function ‘void fileset(str)’:
answer.code:28:28: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 | void fileset(str a){freopen((a+".in").c_str(),"r",stdin);freopen((a+".out").c_str(),"w",stdout);}
      |                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:28:65: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 | void fileset(str a){freopen((a+".in").c_str(),"r",stdin);freopen((a+".out").c_str(),"w",stdout);}
      |                                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~