Description
I have been trying to submit solutions but they keep getting submitted to the wrong problem/contest. Take an example using the snippet below. This code is supposed to be submitted to the walking-robot-simulation-ii
problem which is questionId, 2069. But for some reason, it is always submitted to a different problem: kth-smallest-subarray-sum
. I verified this by checking the latest submission on my submissions on the leetcode website. I have tried this on other problems as well and it get it right on some occasions e.g."two sum" and fail multiple times on others. What could be the reason and can you reproduce this on your side?
import os
import leetcode
from leetcode.api_client import ApiClient
from leetcode.configuration import Configuration
configuration = Configuration()
leetcode_session = os.getenv("LEETCODE_SESSION_ID")
csrf_token = os.getenv("LEETCODE_CSRF_TOKEN")
configuration.api_key["x-csrftoken"] = csrf_token
configuration.api_key["csrftoken"] = csrf_token
configuration.api_key["LEETCODE_SESSION"] = leetcode_session
configuration.api_key["Referer"] = "https://leetcode.com"
configuration.debug = False
configuration.api_key_prefix["Authorization"] = "Bearer"
code = """
from typing import List, Tuple
class Robot:
def __init__(self, width: int, height: int):
self.pos: List[Tuple[List[int], str]] = []
self.pos.append(([0, 0], "South"))
for i in range(1, width):
self.pos.append(([i, 0], "East"))
for j in range(1, height):
self.pos.append(([width - 1, j], "North"))
for i in range(width - 2, -1, -1):
self.pos.append(([i, height - 1], "West"))
for j in range(height - 2, 0, -1):
self.pos.append(([0, j], "South"))
self.isOrigin: bool = True
self.i: int = 0
def step(self, num: int) -> None:
self.isOrigin = False
self.i = (self.i + num) % len(self.pos)
def getPos(self) -> List[int]:
return self.pos[self.i][0]
def getDir(self) -> str:
return "East" if self.isOrigin else self.pos[self.i][1]
"""
submission = leetcode.Submission(
typed_code=code,
judge_type="large",
question_id=2069,
test_mode=False,
lang="python",
)
api_instance = leetcode.DefaultApi(ApiClient(configuration))
submission_id = api_instance.problems_problem_submit_post(
problem="walking-robot-simulation-ii", body=submission
)
print(submission_id)
Additionally, when you try to get the result from the submission_result = api_instance.submissions_detail_id_check_get(id=submission_id)
, you will get an error.