QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#153684#7042. So EasyPetroTarnavskyi#Compile Error//Python3760b2023-08-30 18:54:322023-08-30 18:54:32

Judging History

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

  • [2023-08-30 18:54:32]
  • 评测
  • [2023-08-30 18:54:32]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FILL(a, b) memset(a, b, sizeof(a))
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector a(n, vector<int>(n));
	int r = -1, c = -1;
	FOR(i, 0, n)
		FOR(j, 0, n)
		{
			cin >> a[i][j];
			if (a[i][j] == -1) 
			{
				r = i;
				c = j;
			}
		}
	cout << a[(r + 1) % n][c] + a[r][(c + 1) % n] - a[(r + 1) % n][(c + 1) % n] << "\n";
}

Details