Submission #818057

# Submission time Handle Problem Language Result Execution time Memory
818057 2023-08-10T00:57:32 Z makanhulia Lasers (NOI19_lasers) C++17
24 / 100
63 ms 6044 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void print(ll Z) {
    cout << Z << endl;
}
int main() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
     cout.tie(0);
    ll L, R;
    cin >> L >> R;
    if(R == 1) {
        // Subtask 1
        ll X;
        cin >> X;
        if(X == 1) {
            ll Y;
            cin >> Y;
            if(Y > L/2) {
                if(L % 2) print((Y -(L / 2))*2 - 1);
                else print((Y - (L / 2))*2);
            }
            else print(0);
        }
    }
    else {
        ll ans = 0;
        ll maxY = 0;
        while(R--){
            ll X;
            cin >> X;
            if(X == 1) {
                // Subtask 2
                ll Y;
                cin >> Y;
                maxY = max(maxY, Y);
            }
        }
        if(maxY > L/2) {
                if(L % 2) print((maxY -(L / 2))*2 - 1);
                else print((maxY - (L / 2))*2);
        }
         else print(0);
    }
    return 0;
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:28:12: warning: unused variable 'ans' [-Wunused-variable]
   28 |         ll ans = 0;
      |            ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 58 ms 6044 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 63 ms 6040 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 58 ms 6044 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 63 ms 6040 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 312 KB Output is correct
21 Incorrect 0 ms 212 KB Output isn't correct
22 Halted 0 ms 0 KB -