結果
問題 | No.470 Inverse S+T Problem |
ユーザー | 👑 kmjp |
提出日時 | 2016-12-20 04:09:00 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,520 bytes |
コンパイル時間 | 1,450 ms |
コンパイル使用メモリ | 155,608 KB |
実行使用メモリ | 13,148 KB |
最終ジャッジ日時 | 2023-08-24 01:13:46 |
合計ジャッジ時間 | 22,159 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
12,820 KB |
testcase_01 | AC | 1,914 ms
12,904 KB |
testcase_02 | AC | 7 ms
12,780 KB |
testcase_03 | AC | 7 ms
12,780 KB |
testcase_04 | AC | 6 ms
12,920 KB |
testcase_05 | AC | 6 ms
12,812 KB |
testcase_06 | AC | 6 ms
12,804 KB |
testcase_07 | AC | 6 ms
12,860 KB |
testcase_08 | AC | 7 ms
12,924 KB |
testcase_09 | AC | 6 ms
12,908 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 7 ms
12,876 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 1,915 ms
12,924 KB |
testcase_16 | AC | 11 ms
12,876 KB |
testcase_17 | WA | - |
testcase_18 | AC | 67 ms
12,772 KB |
testcase_19 | AC | 1,915 ms
12,820 KB |
testcase_20 | AC | 7 ms
12,784 KB |
testcase_21 | AC | 7 ms
12,816 KB |
testcase_22 | AC | 7 ms
12,944 KB |
testcase_23 | WA | - |
testcase_24 | AC | 1,913 ms
13,148 KB |
testcase_25 | AC | 1,914 ms
12,820 KB |
testcase_26 | AC | 1,917 ms
13,100 KB |
testcase_27 | AC | 1,914 ms
13,116 KB |
testcase_28 | AC | 7 ms
13,120 KB |
testcase_29 | AC | 7 ms
12,820 KB |
testcase_30 | AC | 6 ms
13,120 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N; string S[101010],R[101010][2]; void solve() { int i,j,k,l,r,x,y; string s; cin>>N; if(N>52) return _P("Impossible\n"); FOR(i,N) cin>>S[i]; double start=clock(); srand(clock()); while(clock()-start<1.9*CLOCKS_PER_SEC) { int A[52]={}; set<string> SS; FOR(i,N) { A[i]=rand()%2; if(A[i]==0) { if(SS.count(S[i].substr(0,1))) goto out; if(SS.count(S[i].substr(1,2))) goto out; SS.insert(S[i].substr(0,1)); SS.insert(S[i].substr(1,2)); } else { if(SS.count(S[i].substr(2,1))) goto out; if(SS.count(S[i].substr(0,2))) goto out; SS.insert(S[i].substr(2,1)); SS.insert(S[i].substr(0,2)); } } FOR(i,N) { if(A[i]==0) cout<<S[i].substr(0,1)<<" "<<S[i].substr(1,2)<<endl; else cout<<S[i].substr(0,2)<<" "<<S[i].substr(2,1)<<endl; } return; out: ; } cout<<"Impossible"<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }