File size: 25,744 Bytes
4840ed8 9d822c3 4840ed8 9d822c3 4840ed8 9d822c3 4840ed8 9d822c3 4840ed8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CodeJudge Pro - Competitive Programming Platform</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/monaco-editor@0.34.0/min/vs/loader.js"></script>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
</head>
<body class="bg-gray-950 text-gray-100 font-inter">
<!-- Navigation -->
<nav class="bg-gray-900 border-b border-gray-800 px-6 py-4">
<div class="max-w-7xl mx-auto flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="bg-gradient-to-r from-blue-500 to-purple-600 w-8 h-8 rounded-lg flex items-center justify-center">
<i class="fas fa-code text-white"></i>
</div>
<h1 class="text-xl font-bold bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text text-transparent">
CodeJudge Pro
</h1>
</div>
<div class="flex items-center space-x-4">
<div class="hidden md:flex space-x-6">
<a href="#" class="hover:text-blue-400 transition-colors">Problems</a>
<a href="#" class="hover:text-blue-400 transition-colors">Contests</a>
<a href="#" class="hover:text-blue-400 transition-colors">Leaderboard</a>
<a href="#" class="hover:text-blue-400 transition-colors">Discuss</a>
</div>
<div class="flex items-center space-x-3">
<div class="relative">
<div class="w-8 h-8 bg-gradient-to-r from-green-500 to-blue-500 rounded-full flex items-center justify-center cursor-pointer">
<span class="text-sm font-bold">JD</span>
</div>
</div>
<button class="bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 px-4 py-2 rounded-lg font-medium transition-all">
Sign In
</button>
</div>
</div>
</div>
</nav>
<!-- Main Container -->
<div class="max-w-7xl mx-auto px-4 py-6">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Problem Panel -->
<div class="lg:col-span-2 space-y-6">
<!-- Problem Header -->
<div class="bg-gray-900 rounded-xl border border-gray-800 p-6">
<div class="flex items-center justify-between mb-4">
<div>
<h2 class="text-2xl font-bold">Two Sum</h2>
<div class="flex items-center space-x-3 mt-2">
<span class="px-3 py-1 bg-green-900/30 text-green-400 rounded-full text-sm font-medium">
Easy
</span>
<span class="text-gray-400 text-sm">
<i class="fas fa-users mr-1"></i> 78.4% Accepted
</span>
<span class="text-gray-400 text-sm">
<i class="fas fa-clock mr-1"></i> 2 sec
</span>
<span class="text-gray-400 text-sm">
<i class="fas fa-memory mr-1"></i> 256 MB
</span>
</div>
</div>
<div class="flex space-x-3">
<button id="runBtn" class="px-4 py-2 bg-blue-900/50 hover:bg-blue-900 text-blue-300 hover:text-blue-200 rounded-lg border border-blue-800/50 transition-colors">
<i class="fas fa-play mr-2"></i>Run Code
</button>
<button id="submitBtn" class="px-4 py-2 bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 rounded-lg font-medium transition-all">
<i class="fas fa-paper-plane mr-2"></i>Submit
</button>
</div>
</div>
<div class="flex border-b border-gray-800 mb-4">
<button class="tab-btn active px-4 py-3 border-b-2 border-blue-500 text-blue-400 font-medium" data-tab="description">
Description
</button>
<button class="tab-btn px-4 py-3 text-gray-400 hover:text-gray-300 font-medium" data-tab="solutions">
Solutions
</button>
<button class="tab-btn px-4 py-3 text-gray-400 hover:text-gray-300 font-medium" data-tab="submissions">
Submissions
</button>
</div>
<!-- Problem Description -->
<div id="description" class="tab-content active">
<div class="space-y-4">
<p class="text-gray-300">
Given an array of integers <code class="bg-gray-800 px-2 py-1 rounded text-blue-300">nums</code> and an integer <code class="bg-gray-800 px-2 py-1 rounded text-blue-300">target</code>, return indices of the two numbers such that they add up to <code class="bg-gray-800 px-2 py-1 rounded text-blue-300">target</code>.
</p>
<p class="text-gray-300">
You may assume that each input would have <strong>exactly one solution</strong>, and you may not use the same element twice.
</p>
<p class="text-gray-300">
You can return the answer in any order.
</p>
<div class="bg-gray-800/50 rounded-lg p-4 border border-gray-700">
<h4 class="font-bold text-lg mb-3">Example 1:</h4>
<div class="space-y-2">
<div class="flex">
<span class="text-gray-400 min-w-24">Input:</span>
<code class="bg-gray-900 px-3 py-1 rounded">nums = [2,7,11,15], target = 9</code>
</div>
<div class="flex">
<span class="text-gray-400 min-w-24">Output:</span>
<code class="bg-gray-900 px-3 py-1 rounded">[0,1]</code>
</div>
<div class="text-gray-400 text-sm">
<strong>Explanation:</strong> Because nums[0] + nums[1] == 9, we return [0, 1].
</div>
</div>
</div>
<div class="bg-gray-800/50 rounded-lg p-4 border border-gray-700">
<h4 class="font-bold text-lg mb-3">Example 2:</h4>
<div class="space-y-2">
<div class="flex">
<span class="text-gray-400 min-w-24">Input:</span>
<code class="bg-gray-900 px-3 py-1 rounded">nums = [3,2,4], target = 6</code>
</div>
<div class="flex">
<span class="text-gray-400 min-w-24">Output:</span>
<code class="bg-gray-900 px-3 py-1 rounded">[1,2]</code>
</div>
</div>
</div>
<div class="bg-gray-800/50 rounded-lg p-4 border border-gray-700">
<h4 class="font-bold text-lg mb-2">Constraints:</h4>
<ul class="list-disc list-inside space-y-1 text-gray-300">
<li><code class="bg-gray-900 px-1 py-0.5 rounded">2 <= nums.length <= 10^4</code></li>
<li><code class="bg-gray-900 px-1 py-0.5 rounded">-10^9 <= nums[i] <= 10^9</code></li>
<li><code class="bg-gray-900 px-1 py-0.5 rounded">-10^9 <= target <= 10^9</code></li>
<li><strong>Only one valid answer exists.</strong></li>
</ul>
</div>
</div>
</div>
<!-- Solutions Tab -->
<div id="solutions" class="tab-content hidden">
<div class="space-y-4">
<div class="bg-gray-800/50 rounded-lg p-4 border border-gray-700">
<h4 class="font-bold text-lg mb-3">Optimal Solution (Hash Map)</h4>
<p class="text-gray-300 mb-3">Time Complexity: O(n), Space Complexity: O(n)</p>
<pre class="bg-gray-900 p-4 rounded-lg overflow-x-auto text-sm">
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int, int> map;
for (int i = 0; i < nums.size(); i++) {
int complement = target - nums[i];
if (map.find(complement) != map.end()) {
return {map[complement], i};
}
map[nums[i]] = i;
}
return {};
}
};</pre>
</div>
</div>
</div>
<!-- Submissions Tab -->
<div id="submissions" class="tab-content hidden">
<div class="space-y-3">
<div class="flex items-center justify-between bg-gray-800/30 p-3 rounded-lg">
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-green-500 rounded-full"></div>
<span class="font-mono text-sm">Accepted</span>
</div>
<div class="text-sm text-gray-400">2 seconds ago</div>
</div>
<div class="flex items-center justify-between bg-gray-800/30 p-3 rounded-lg">
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-red-500 rounded-full"></div>
<span class="font-mono text-sm">Wrong Answer</span>
</div>
<div class="text-sm text-gray-400">5 minutes ago</div>
</div>
</div>
</div>
</div>
<!-- Test Cases Section -->
<div class="bg-gray-900 rounded-xl border border-gray-800 p-6">
<h3 class="text-lg font-bold mb-4">Test Cases</h3>
<div class="space-y-4">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-gray-800/50 rounded-lg p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-sm font-medium text-gray-300">Test Case 1</span>
<span class="px-2 py-1 bg-green-900/30 text-green-400 rounded text-xs">Visible</span>
</div>
<div class="space-y-2">
<div>
<span class="text-gray-400 text-sm">Input:</span>
<div class="bg-gray-900 p-2 rounded mt-1 font-mono text-sm">nums = [2,7,11,15]<br>target = 9</div>
</div>
<div>
<span class="text-gray-400 text-sm">Expected Output:</span>
<div class="bg-gray-900 p-2 rounded mt-1 font-mono text-sm">[0,1]</div>
</div>
</div>
</div>
<div class="bg-gray-800/50 rounded-lg p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-sm font-medium text-gray-300">Test Case 2</span>
<span class="px-2 py-1 bg-red-900/30 text-red-400 rounded text-xs">Hidden</span>
</div>
<div class="space-y-2">
<div>
<span class="text-gray-400 text-sm">Input:</span>
<div class="bg-gray-900 p-2 rounded mt-1 font-mono text-sm">Hidden test case</div>
</div>
<div>
<span class="text-gray-400 text-sm">Expected Output:</span>
<div class="bg-gray-900 p-2 rounded mt-1 font-mono text-sm">Hidden</div>
</div>
</div>
</div>
</div>
<div class="flex items-center justify-between">
<div class="text-sm text-gray-400">
<i class="fas fa-info-circle mr-1"></i> 2 visible test cases, 5 hidden test cases
</div>
<button id="addTestBtn" class="text-sm text-blue-400 hover:text-blue-300">
<i class="fas fa-plus mr-1"></i>Add Custom Test Case
</button>
</div>
</div>
</div>
</div>
<!-- Code Editor Panel -->
<div class="space-y-6">
<!-- Editor Header -->
<div class="bg-gray-900 rounded-xl border border-gray-800 p-4">
<div class="flex items-center justify-between mb-4">
<h3 class="font-bold">Code Editor</h3>
<div class="flex items-center space-x-3">
<div class="relative group">
<select id="languageSelect" class="bg-gray-800 border border-gray-700 text-gray-300 rounded-lg px-3 py-2 appearance-none cursor-pointer">
<option value="cpp">C++ 17</option>
<option value="python">Python 3</option>
<option value="java">Java 17</option>
</select>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-400">
<i class="fas fa-chevron-down"></i>
</div>
</div>
<button id="resetBtn" class="px-3 py-2 bg-gray-800 hover:bg-gray-700 rounded-lg text-gray-300 hover:text-gray-100 transition-colors">
<i class="fas fa-redo"></i>
</button>
</div>
</div>
<!-- Code Editor Container -->
<div id="editorContainer" class="h-[500px] rounded-lg border border-gray-700 overflow-hidden">
<!-- Monaco Editor will be loaded here -->
</div>
<!-- Editor Status Bar -->
<div class="flex items-center justify-between mt-4 pt-4 border-t border-gray-800">
<div class="flex items-center space-x-4 text-sm text-gray-400">
<div class="flex items-center">
<i class="fas fa-code mr-2"></i>
<span id="lineCount">Line: 1</span>
</div>
<div class="flex items-center">
<i class="fas fa-font mr-2"></i>
<span id="charCount">Chars: 0</span>
</div>
</div>
<div class="flex items-center space-x-3">
<button id="formatBtn" class="px-3 py-1.5 bg-gray-800 hover:bg-gray-700 rounded text-sm transition-colors">
<i class="fas fa-broom mr-1"></i>Format
</button>
<button id="themeToggle" class="px-3 py-1.5 bg-gray-800 hover:bg-gray-700 rounded text-sm transition-colors">
<i class="fas fa-moon mr-1"></i>Dark
</button>
</div>
</div>
</div>
<!-- Compilation & Output Panel -->
<div class="bg-gray-900 rounded-xl border border-gray-800 overflow-hidden">
<div class="border-b border-gray-800">
<div class="flex">
<button class="output-tab active px-4 py-3 font-medium border-b-2 border-blue-500 text-blue-400" data-tab="output">
<i class="fas fa-terminal mr-2"></i>Output
</button>
<button class="output-tab px-4 py-3 font-medium text-gray-400 hover:text-gray-300" data-tab="console">
<i class="fas fa-code mr-2"></i>Console
</button>
</div>
</div>
<div id="outputPanel" class="p-4">
<!-- Execution Status -->
<div id="executionStatus" class="hidden mb-4">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div id="statusIcon" class="w-4 h-4 rounded-full bg-yellow-500 animate-pulse"></div>
<span id="statusText" class="font-medium">Compiling...</span>
</div>
<div id="timer" class="text-sm text-gray-400">0.0s</div>
</div>
<div id="progressBar" class="h-1 bg-gray-800 rounded-full mt-2 overflow-hidden">
<div class="h-full bg-blue-500 progress-animation"></div>
</div>
</div>
<!-- Results -->
<div id="resultsContainer" class="space-y-4">
<div class="text-center py-8 text-gray-500">
<i class="fas fa-play-circle text-3xl mb-3"></i>
<p class="text-sm">Click "Run Code" to execute your solution</p>
</div>
</div>
<!-- Console Output -->
<div id="consoleOutput" class="hidden font-mono text-sm">
<div class="bg-gray-800 rounded p-3 mb-2">
<span class="text-green-400">$</span> g++ -std=c++17 -O2 -o solution solution.cpp
</div>
<div class="bg-gray-800 rounded p-3">
<span class="text-green-400">$</span> ./solution < test_input.txt
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Toast Notification -->
<div id="toast" class="fixed bottom-6 right-6 bg-gray-900 border border-gray-700 rounded-lg p-4 shadow-xl transform translate-y-full transition-transform duration-300 z-50 max-w-md">
<div class="flex items-center">
<div id="toastIcon" class="w-6 h-6 rounded-full mr-3 flex items-center justify-center">
<i class="fas fa-info text-white text-xs"></i>
</div>
<div>
<h4 id="toastTitle" class="font-bold">Notification</h4>
<p id="toastMessage" class="text-sm text-gray-300">This is a toast message</p>
</div>
<button id="closeToast" class="ml-auto text-gray-400 hover:text-gray-200">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<!-- Loading Overlay -->
<div id="loadingOverlay" class="fixed inset-0 bg-gray-950/80 flex items-center justify-center z-50 hidden">
<div class="bg-gray-900 rounded-xl border border-gray-800 p-8 max-w-md w-full mx-4">
<div class="flex flex-col items-center">
<div class="w-16 h-16 border-4 border-blue-500 border-t-transparent rounded-full animate-spin mb-4"></div>
<h3 class="text-xl font-bold mb-2" id="loadingTitle">Judging Your Solution</h3>
<p class="text-gray-400 text-center mb-6" id="loadingMessage">Compiling and running test cases...</p>
<div class="w-full bg-gray-800 rounded-full h-2 overflow-hidden">
<div class="h-full bg-gradient-to-r from-blue-500 to-purple-600 progress-animation-wide"></div>
</div>
</div>
</div>
</div>
<!-- Add Test Case Modal -->
<div id="testCaseModal" class="fixed inset-0 bg-gray-950/80 flex items-center justify-center z-50 hidden">
<div class="bg-gray-900 rounded-xl border border-gray-800 p-6 max-w-lg w-full mx-4">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Add Custom Test Case</h3>
<button id="closeTestCaseModal" class="text-gray-400 hover:text-gray-200">
<i class="fas fa-times text-xl"></i>
</button>
</div>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-300 mb-2">Input</label>
<textarea id="customInput" class="w-full bg-gray-800 border border-gray-700 rounded-lg p-3 font-mono text-sm h-32" placeholder="Enter test input..."></textarea>
</div>
<div>
<label class="block text-sm font-medium text-gray-300 mb-2">Expected Output</label>
<textarea id="customOutput" class="w-full bg-gray-800 border border-gray-700 rounded-lg p-3 font-mono text-sm h-24" placeholder="Enter expected output..."></textarea>
</div>
<div class="flex justify-end space-x-3 pt-4">
<button id="cancelTestCase" class="px-4 py-2 bg-gray-800 hover:bg-gray-700 rounded-lg">Cancel</button>
<button id="saveTestCase" class="px-4 py-2 bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 rounded-lg">Add Test Case</button>
</div>
</div>
</div>
</div>
<!-- Submission Detail Modal -->
<div id="submissionModal" class="fixed inset-0 bg-gray-950/80 flex items-center justify-center z-50 hidden">
<div class="bg-gray-900 rounded-xl border border-gray-800 p-6 max-w-3xl w-full mx-4 max-h-[80vh] overflow-y-auto">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Submission Details</h3>
<button id="closeSubmissionModal" class="text-gray-400 hover:text-gray-200">
<i class="fas fa-times text-xl"></i>
</button>
</div>
<div id="submissionDetailContent" class="space-y-4">
<!-- Content will be dynamically inserted here -->
</div>
</div>
</div>
<script src="script.js"></script>
<script src="script-fixes.js"></script>
<script src="https://deepsite.hf.co/deepsite-badge.js"></script>
</body>
</html> |