QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#93923 | #2174. Which Planet is This?! | _skb_ | WA | 192ms | 7644kb | C++17 | 2.6kb | 2023-04-04 02:58:26 | 2023-04-04 02:58:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
struct debug {
#define contPrint { *this << "["; \
int f = 0; for(auto it : x) { *this << (f?", ":""); *this << it; f = 1;} \
*this << "]"; return *this;}
~debug(){cerr << endl;}
template<class c> debug& operator<<(c x) {cerr << x; return *this;}
template<class c, class d>
debug& operator<<(pair<c, d> x) {*this << "(" << x.first << ", " << x.second << ")";
return *this;}
template<class c> debug& operator<<(vector<c> x) contPrint;
#undef contPrint
};
#define dbg(x) "[" << #x << ": " << x << "] "
#define Wa() cerr << "[LINE: " << __LINE__ << "] -> "; debug() <<
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);
int main()
{
int n;
scanf("%d", &n);
auto to_int = [] (char ch[]) {
int len = strlen(ch);
int dot = len;
bool neg = false;
int start = 0;
if(ch[0] == '-') neg = true, start = 1;
for(int i = start; i < len; i++) {
if(ch[i] == '.') {
dot = i;
}
}
int ret = 0;
for(int i = start; i < dot; i++) {
ret *= 10;
ret += (ch[i] - '0');
}
string s = "";
for(int i = dot + 1; i < len; i++) {
s += ch[i];
}
while(s.length() < 4) s += '0';
for(int i = 0; i < 4; i++) {
ret *= 10;
ret += (s[i] - '0');
}
if(neg) ret *= -1;
return ret;
};
int mn1 = 1e9;
map<int, vector<int>> first;
for(int i = 0; i < n; i++) {
char ch1[15], ch2[15];
scanf(" %s %s", ch1, ch2);
first[to_int(ch1)].push_back(to_int(ch2));
mn1 = min(mn1, to_int(ch2));
}
int mn2 = 1e9;
map<int, vector<int>> second;
for(int i = 0; i < n; i++) {
char ch1[15], ch2[15];
scanf(" %s %s", ch1, ch2);
second[to_int(ch1)].push_back(to_int(ch2));
mn2 = min(mn2, to_int(ch2));
}
for(auto& it : first) {
for(int& i : it.second) {
i -= mn1;
}
sort(it.second.begin(), it.second.end());
}
for(auto& it : second) {
for(int& i : it.second) {
i -= mn2;
}
sort(it.second.begin(), it.second.end());
}
for(auto it : first) {
if(it.second != second[it.first]) {
puts("Different");
return 0;
}
}
// cerr << "Same\n";
puts("Same");
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3404kb
input:
3 10 0 20 40 30 -15 40 -15 20 0 30 40
output:
Different
result:
ok single line: 'Different'
Test #2:
score: -100
Wrong Answer
time: 192ms
memory: 7644kb
input:
359998 -0.0045 96.8638 -0.0045 -79.2284 -0.0045 -50.4113 -0.0045 -79.0394 -0.0045 -24.9710 -0.0045 -142.9880 -0.0045 50.6344 -0.0045 125.9464 -0.0045 -17.3039 -0.0045 42.3454 -0.0045 130.6138 -0.0045 -106.4363 -0.0045 -95.9378 -0.0045 90.7312 -0.0045 75.7615 -0.0045 -66.9785 -0.0045 -81.0752 -0.0045...
output:
Different
result:
wrong answer 1st lines differ - expected: 'Same', found: 'Different'