DMOJ / judge-server

Judging backend server for the DMOJ online judge.
https://dmoj.ca
GNU Affero General Public License v3.0
891 stars 253 forks source link

Inconsistencies in Dart judges #957

Closed DO-Ui closed 1 year ago

DO-Ui commented 3 years ago

I'm not sure why this is happening but there appear to be some problems with the judges tle'ing sometimes but other times accepting the answer. This happened to me when I was submitting to https://dmoj.ca/problem/bf3 in dart. I used code that should not have tle'd but somehow exceeded the time limit, resubmitting somehow gave me an accepted answer.

https://dmoj.ca/submission/3951945 https://dmoj.ca/submission/3951955

The code:

import 'dart:math';
import 'dart:io';
bool prime(int p) {
  for (int i = 2; i < sqrt(p).floor(); i++) {
    if (p % i == 0) { 
      return false;
    }
  }
  if (p == 1){
      return false;
  }
  return true;
}
void main() {
  int n = int.parse(stdin.readLineSync()!);

  while (prime(n) != true) {
    n++;
  }

  stdout.write(n);
}

Same code, different status.

My guess is an issue with input and output because when I submitted this code it tle'd:

import 'dart:io';
main() { 
  int n = int.parse(stdin.readLineSync()!);
  print(n);

}

Somehow this code managed to tle despite only having an input and output. https://dmoj.ca/submission/3951921

Xyene commented 3 years ago

This seems like it might be an upstream Dart issue. I've reported it in https://github.com/dart-lang/sdk/issues/47448.

Xyene commented 1 year ago

This has been fixed(!!) upstream in https://github.com/dart-lang/sdk/commit/ab287309e52eff8cb25a6457aae3bc621a410838, just waiting on a release now.

Xyene commented 1 year ago

3.0.0 finally shipped, containing the fix for this!

I've just rolled it to https://dmoj.ca, and rejudged all Dart submissions made outside of a contest.