Submission #263954

# Submission time Handle Problem Language Result Execution time Memory
263954 2020-08-14T04:30:47 Z 반딧불(#5094) Tram (CEOI13_tram) C++17
0 / 100
1000 ms 492 KB
#include <bits/stdc++.h>
#define SQR(x) ((x)*(x))

using namespace std;

typedef long long ll;

int n, m, p;
int x[1502], y[1502];
bool riding[1502];
bool occupied[1502][3];

int main(){
    scanf("%d %d", &n, &m);
    for(int q=1; q<=m; q++){
        char c;
        scanf(" %c", &c);
        if(c == 'E'){
            ll dist = 0;
            p++;
            for(int i=1; i<=n; i++) for(int j=1; j<=2; j++){
                if(occupied[i][j]) continue;
                ll minDist = 1e18;
                for(int x=1; x<=n; x++) for(int y=1; y<=2; y++){
                    if(occupied[x][y]) minDist = min(minDist, SQR(ll(i-x)) + SQR(ll(j-y)));
                }
                if(minDist > dist){
                    dist = minDist;
                    x[p] = i, y[p] = j;
                }
            }
            occupied[x[p]][y[p]] = 1;
        }
        else{
            int p;
            scanf("%d", &p);
            occupied[x[p]][y[p]] = 0;
        }
    }
    for(int i=1; i<=p; i++){
        printf("%d %d\n", x[i], y[i]);
    }
}

Compilation message

tram.cpp: In function 'int main()':
tram.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
tram.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |         scanf(" %c", &c);
      |         ~~~~~^~~~~~~~~~~
tram.cpp:36:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   36 |             scanf("%d", &p);
      |             ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -