QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#212517#3860. Drone PhotoultralakoTL 1ms3616kbC++141008b2023-10-13 16:46:142023-10-13 16:46:15

Judging History

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

  • [2023-10-13 16:46:15]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3616kb
  • [2023-10-13 16:46:14]
  • 提交

answer

#include <bits/stdc++.h> 
using namespace std; 

using ll = long long;

int ages[1505][1505];
int ways = 0;
int n;

bool logoValid(int x1, int y1, int x2, int y2) {
    return min(ages[x1][y1], ages[x2][y1]) > max(ages[x1][y2], ages[x2][y2]) ||
    max(ages[x1][y1], ages[x2][y1]) < min(ages[x1][y2], ages[x2][y2]) ||
    min(ages[x1][y1], ages[x1][y2]) > max(ages[x2][y1], ages[x2][y2]) ||
    max(ages[x1][y1], ages[x1][y2]) < min(ages[x2][y1], ages[x2][y2]);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); 

    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> ages[i][j];
        }
    }

    for (int x1 = 1; x1 <= n; x1++) {
        for (int x2 = x1 + 1; x2 <= n; x2++) {
            for (int y1 = 1; y1 <= n; y1++) {
                for (int y2 = y1 + 1; y2 <= n; y2++) {
                    ways += logoValid(x1, y1, x2, y2);
                }
            }
        }
    }

    cout << ways;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3616kb

input:

2
1 3
4 2

output:

0

result:

ok single line: '0'

Test #2:

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

input:

2
3 2
4 1

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3356kb

input:

3
9 2 4
1 5 3
7 8 6

output:

6

result:

ok single line: '6'

Test #4:

score: -100
Time Limit Exceeded

input:

1500
2248501 2248502 2248503 2248504 2248505 2248506 2248507 2248508 2248509 2248510 2248511 2248512 2248513 2248514 2248515 2248516 2248517 2248518 2248519 2248520 2248521 2248522 2248523 2248524 2248525 2248526 2248527 2248528 2248529 2248530 2248531 2248532 2248533 2248534 2248535 2248536 2248537...

output:


result: