Submission #1834464
Source Code Expand
#include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <vector> #include <map> #include <set> using namespace std; int main() { int n; scanf("%d", &n); vector<pair<long long, int>> a(2 * n); for (int i = 0; i < 2 * n; i ++) { scanf("%lld", &a[i].first); if (i < n) a[i].second = 1; else a[i].second = -1; } sort(a.begin(), a.end()); int total = 0; long long ans = 1; for (int i = 0; i < 2 * n; i ++) { int type = a[i].second; if (type > 0 && total < 0) ans = ans * -total; if (type < 0 && total > 0) ans = ans * total; total += type; } printf("%lld\n", ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | KokiYmgch |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 843 Byte |
Status | WA |
Exec Time | 40 ms |
Memory | 3328 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:12:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ ./Main.cpp:15:43: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld", &a[i].first); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0.txt, example1.txt |
All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, example0.txt, example1.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
000.txt | WA | 24 ms | 2176 KB |
001.txt | WA | 9 ms | 896 KB |
002.txt | WA | 13 ms | 1152 KB |
003.txt | WA | 14 ms | 1280 KB |
004.txt | WA | 36 ms | 3072 KB |
005.txt | WA | 40 ms | 3328 KB |
006.txt | WA | 40 ms | 3328 KB |
007.txt | WA | 39 ms | 3328 KB |
008.txt | WA | 40 ms | 3328 KB |
009.txt | WA | 40 ms | 3328 KB |
010.txt | WA | 38 ms | 3328 KB |
011.txt | AC | 39 ms | 3328 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |