Submission #553883

#TimeUsernameProblemLanguageResultExecution timeMemory
553883elazarkorenRobots (IOI13_robots)C++17
14 / 100
122 ms15944 KiB
#include "robots.h"
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

bool good[2][2];

int putaway(int a, int b, int t, int x[], int y[], int w[], int s[]) {
    vii robots;
    for (int i = 0; i < a; i++) {
        robots.push_back({i, 0});
    }
    for (int j = 0; j < b; j++) {
        robots.push_back({j, 1});
    }
    for (int i = 0; i < t; i++) {
        int count = 0;
        for (int j = 0; j < 2; j++) {
            if (robots[j].y && s[i] < y[robots[j].x]) {
                good[i][j] = true;
                count++;
            } else if (!robots[j].y && w[i] < x[robots[j].x]) {
                good[i][j] = true;
                count++;
            }
        }
        if (!count) return -1;
    }
    if (good[0][0] && good[1][1] || good[1][0] && good[0][1]) return 1;
    return 2;
}

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:38:20: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   38 |     if (good[0][0] && good[1][1] || good[1][0] && good[0][1]) return 1;
      |         ~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...