QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#406033#6563. Four Squareliuzhenhao09#Compile Error//C++202.2kb2024-05-06 19:06:492024-05-06 19:06:49

Judging History

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

  • [2024-05-06 19:06:49]
  • 评测
  • [2024-05-06 19:06:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ii pair<int,int>
#define i4 array<int, 4>
#define ff first
#define ss second
int x[4], y[4], a[4000][4000];

int main()
{
    int cur = 0;
    for (int i=0; i<4; i++) cin>>x[i]>>y[i], cur += x[i] * y[i];
    int sq = sqrt(cur);
    if (sq * sq != cur) return cout<<0, 0;
    for (int i=0; i<16; i++)
    {
        vector<ii> v;
        for (int j=0; j<4; j++) if (i >> j & 1) v.push_back({y[j], x[j]}); else v.push_back({x[j], y[j]});
        sort(v.begin(), v.end());
        do
        {  
            bool f = 1;
            vector<i4> ve;
            for (auto [x, y]: v)
            {
                int xx = -1, yy = -1;
                for (int i=0; i<=sq; i++)
                {
                    int curcol = 0;
                    vector<int> so;
                    for (auto rec: ve)
                    {
                        if (rec[0] <= i && rec[2] > i) 
                            so.push_back(rec[1]), so.push_back(rec[3]);
                    }
                    sort(so.begin(), so.end());
                    int allow = -1;
                    for (int j=0; j<so.size(); j+=2)
                    {
                        if (so[j] == curcol) curcol = so[j+1];
                        else
                        {
                            allow = so[j] - curcol;
                            break;
                        }
                    }
                    if (allow == -1) allow = sq - curcol;
                    if (allow > 0) 
                    {
                        xx = i;
                        yy = curcol;
                        if (allow < y) f = 0;
                        break;
                    }
                }
                if (!f) break;
                if (xx + x > sq || yy + y > sq)
                {
                    f = 0;
                    break;
                }
                ve.push_back({xx, yy, xx+x, yy+y});
                sort(ve.begin(), ve.end());
            }
            if (f) 
                return cout<<1, 0;
            }
        } while (next_permutation(v.begin(), v.end()));
        
    }
    cout<<0;
}

详细

answer.code: In function ‘int main()’:
answer.code:68:9: error: expected ‘while’ before ‘}’ token
   68 |         } while (next_permutation(v.begin(), v.end()));
      |         ^
answer.code:68:9: error: expected ‘(’ before ‘}’ token
   68 |         } while (next_permutation(v.begin(), v.end()));
      |         ^
      |         (
answer.code:68:9: error: expected primary-expression before ‘}’ token
answer.code:67:14: error: expected ‘)’ before ‘}’ token
   67 |             }
      |              ^
      |              )
   68 |         } while (next_permutation(v.begin(), v.end()));
      |         ~     
answer.code:67:14: error: expected ‘;’ before ‘}’ token
   67 |             }
      |              ^
      |              ;
   68 |         } while (next_permutation(v.begin(), v.end()));
      |         ~     
answer.code:68:35: error: ‘v’ was not declared in this scope
   68 |         } while (next_permutation(v.begin(), v.end()));
      |                                   ^
answer.code: At global scope:
answer.code:71:5: error: ‘cout’ does not name a type
   71 |     cout<<0;
      |     ^~~~
answer.code:72:1: error: expected declaration before ‘}’ token
   72 | }
      | ^