QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#647120#7704. Plus Minus Four Squaresenze114514WA 2ms3792kbC++204.9kb2024-10-17 11:50:142024-10-17 11:50:16

Judging History

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

  • [2024-10-17 11:50:16]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3792kb
  • [2024-10-17 11:50:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define pb push_back

const ld pi = 3.14159265358979323846;
const ll INF = 1e18;

template<typename T>
T chmax(T a, T b) {
    return a > b ? a : b;
}

template<typename T>
T chmin(T a, T b) {
    return a > b ? b : a;
}

void solve() {
    int n;
    cin >> n;

    int qwq = 0;
    map<vector<int>, int> mp;
    for(int i = 0; i * i <= n; i++){
        for(int j = 0; j <= i; j++){
            for(int k = 0; k <= j; k++){
                for(int l = 0; l <= k; l++){
                    if(i * i == j * j && j * j == k * k && k * k == l * l){
                        if(i * i + j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                    }
                    else if(i * i == j * j && j * j == k * k){
                        if(i * i + j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j - k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                    }
                    else if(j * j == k * k && k * k == l * l){
                        if(i * i - j * j - k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                    }
                    else if(i * i == j * j){
                        if(i * i + j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j - k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j - k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j + k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                    }
                    else if(j * j == k * k){
                        if(i * i + j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j + k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i - j * j - k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i - j * j - k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                    }
                    else if(k * k == l * l){
                        if(i * i + j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i - j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j - k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i - j * j - k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                    }
                    else{
                        if(i * i + j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i - j * j - k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i - j * j + k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j - k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j + k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i + j * j - k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i - j * j + k * k + l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                        if(i * i - j * j - k * k - l * l == n){
                            mp[{i, j, k, l}] = 1;
                        }
                    }
                }
            }
        }
    }

    cout << mp.size() << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

64

output:

12

result:

ok single line: '12'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

65

output:

10

result:

ok single line: '10'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

2023

output:

245

result:

ok single line: '245'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

0

output:

1

result:

ok single line: '1'

Test #5:

score: -100
Wrong Answer
time: 2ms
memory: 3716kb

input:

5000

output:

1000

result:

wrong answer 1st lines differ - expected: '951', found: '1000'