CSES - Datatähti 2022 alku - Results
Submission details
Task:Spiraali
Sender:ileska
Submission time:2021-10-08 10:24:25 +0300
Language:C++11
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:26:17: error: 'else' without a previous 'if'
 ;;;;;;;;;;;;;;;;else
                 ^~~~
input/code.cpp:31:13: error: 'else' without a previous 'if'
 ;;;;;;;;;;;;else
             ^~~~
input/code.cpp:38:17: error: 'else' without a previous 'if'
 ;;;;;;;;;;;;;;;;else
                 ^~~~
input/code.cpp:44:9: error: 'else' without a previous 'if'
 ;;;;;;;;else
         ^~~~
input/code.cpp:51:13: error: 'else' without a previous 'if'
 ;;;;;;;;;;;;else
             ^~~~

Code

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
;;;;long long n, t, y, x;
;;;;cin >> n >> t;

;;;;if (n % 2 == 1)
;;;;{
;;;;;;;;return 1;
;;;;}

;;;;for (int i = 0; i < t; i++)
;;;;{
;;;;;;;;cin >> y >> x;
;;;;;;;;if (abs(n / 2 - y) >= abs(n / 2 - x))
;;;;;;;;{
;;;;;;;;;;;;if (y > (n / 2))
;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;//toimii ÁLÄ KOSKE
;;;;;;;;;;;;;;;;if (y == n - x)
;;;;;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;;;;;cout << 4 * (x - 1) * (n - x + 1) + (y - x + 1) << endl;
;;;;;;;;;;;;;;;;}
;;;;;;;;;;;;;;;;else
;;;;;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;;;;;cout << 4 * n * y - n - 4 * y * y + 2 * y + x - (n - y) - 1 << endl;
;;;;;;;;;;;;;;;;}
;;;;;;;;;;;;}
;;;;;;;;;;;;else
;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;//toimii ehkä kokeile
;;;;;;;;;;;;;;;;if (x == y)
;;;;;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;;;;;cout << 4 * (x - 1) * (n - x + 1) + (y - x + 1) << endl;
;;;;;;;;;;;;;;;;}
;;;;;;;;;;;;;;;;else
;;;;;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;;;;;cout << 4 * (y - 1) * (n - y + 1) + 2 * (n - (2 * (y - 1))) - 1 + n - 2 * (y - 1) - 1 + (n - x - (y - 1)) << endl;
;;;;;;;;;;;;;;;;}
;;;;;;;;;;;;}
;;;;;;;;}
;;;;;;;;else
;;;;;;;;{
;;;;;;;;;;;;if (x > (n / 2))
;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;//toimii ÁLÄ KOSKE
;;;;;;;;;;;;;;;;cout << 4 * x * (n - x) - 2 * n + 4 * x - 1 + (n - y - (n - x)) << endl;
;;;;;;;;;;;;}
;;;;;;;;;;;;else
;;;;;;;;;;;;{
;;;;;;;;;;;;;;;;//toimii ÁLÄ KOSKE
;;;;;;;;;;;;;;;;cout << 4 * (x - 1) * (n - x + 1) + (y - x + 1) << endl;
;;;;;;;;;;;;}
;;;;;;;;}
;;;;}
;;;;return 0;
}