| Task: | Lucky numbers |
| Sender: | Pietari Kaskela |
| Submission time: | 2016-09-13 18:59:23 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | TIME LIMIT EXCEEDED |
| test | verdict | time | |
|---|---|---|---|
| #1 | TIME LIMIT EXCEEDED | -- | details |
| #2 | RUNTIME ERROR | 0.12 s | details |
| #3 | RUNTIME ERROR | 0.14 s | details |
| #4 | RUNTIME ERROR | 0.14 s | details |
| #5 | RUNTIME ERROR | 0.14 s | details |
| #6 | RUNTIME ERROR | 0.14 s | details |
| #7 | RUNTIME ERROR | 0.13 s | details |
| #8 | RUNTIME ERROR | 0.15 s | details |
| #9 | RUNTIME ERROR | 0.16 s | details |
| #10 | RUNTIME ERROR | 0.15 s | details |
| #11 | RUNTIME ERROR | 0.16 s | details |
| #12 | RUNTIME ERROR | 0.14 s | details |
| #13 | RUNTIME ERROR | 0.12 s | details |
| #14 | RUNTIME ERROR | 0.13 s | details |
| #15 | RUNTIME ERROR | 0.14 s | details |
| #16 | RUNTIME ERROR | 0.13 s | details |
| #17 | RUNTIME ERROR | 0.15 s | details |
| #18 | RUNTIME ERROR | 0.15 s | details |
| #19 | RUNTIME ERROR | 0.14 s | details |
| #20 | RUNTIME ERROR | 0.15 s | details |
Code
#include <bits/stdc++.h>
#define i64 long long
#define u64 unsigned long long
#define i32 int
#define u32 unsigned int
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ld long double
#define defmod 1000000007
#define mati64(a,b) vector<vector<i64>>(a, vector<i64>(b, 0));
using namespace std;
int main(){
cin.sync_with_stdio(0);
cin.tie(0);
srand(time(0));
int n, m; cin >> n >> m;
vector<int> lol[1010];
for(int i = 0; i < n; ++i){
lol[i] = vector<int>(7);
for(int j = 0; j < 7; ++j)
cin >> lol[i][j];
}
string ans = "";
int cc = 10000;
while(cc--){
string a(m+1, '0');
for(int i = 0; i < n; ++i){
for(int j = 0; j < 7; ++j){
if(rand()%10 < 5)
a[abs(lol[i][j])] = '1';
else
a[abs(lol[i][j])] = '0';
}
}
bool ok = true;
for(int i = 0; i < n; ++i){
bool ok2 = false;
for(int j = 0; j < 7; ++j){
if(lol[i][j] < 0 && a[-lol[i][j]] == '1')
ok2 = true;
else if(lol[i][j] > 0 && a[lol[i][j]] == '1')
ok2 = true;
}
if(!ok2){
ok = false;
break;
}
}
if(ok){
ans = a.substr(1, m);
break;
}
}
if(ans.length() == 0)
cout << "UNSAT" << endl;
else
cout << "SAT" << endl << ans << endl;
return 0;
}
Test details
Test 1
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 932 |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 622897 |
| correct output |
|---|
| 4 |
| user output |
|---|
| (empty) |
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 147656 |
| correct output |
|---|
| 3 |
| user output |
|---|
| (empty) |
Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 3452 |
| correct output |
|---|
| 4 |
| user output |
|---|
| (empty) |
Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| 788431492 |
| correct output |
|---|
| 7 |
| user output |
|---|
| (empty) |
Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| 989266495048717272261061594909... |
| correct output |
|---|
| 48 |
| user output |
|---|
| (empty) |
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 656115984810304444763175 |
| correct output |
|---|
| 18 |
| user output |
|---|
| (empty) |
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 821785741859753883189643338604... |
| correct output |
|---|
| 49 |
| user output |
|---|
| (empty) |
Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 989368021051 |
| correct output |
|---|
| 8 |
| user output |
|---|
| (empty) |
Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 850646258628472406299081311034... |
| correct output |
|---|
| 75 |
| user output |
|---|
| (empty) |
Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| 905529028380409196254499360502... |
| correct output |
|---|
| 73 |
| user output |
|---|
| (empty) |
Test 12
Verdict: RUNTIME ERROR
| input |
|---|
| 910487086247939283017891549257... |
| correct output |
|---|
| 71 |
| user output |
|---|
| (empty) |
Test 13
Verdict: RUNTIME ERROR
| input |
|---|
| 819648081022975646379749170608... |
| correct output |
|---|
| 74 |
| user output |
|---|
| (empty) |
Test 14
Verdict: RUNTIME ERROR
| input |
|---|
| 534150835659907637615065081226... |
| correct output |
|---|
| 76 |
| user output |
|---|
| (empty) |
Test 15
Verdict: RUNTIME ERROR
| input |
|---|
| 903033794991942065956114372733... |
| correct output |
|---|
| 78 |
| user output |
|---|
| (empty) |
Test 16
Verdict: RUNTIME ERROR
| input |
|---|
| 737347217956895521599162105321... |
| correct output |
|---|
| 71 |
| user output |
|---|
| (empty) |
Test 17
Verdict: RUNTIME ERROR
| input |
|---|
| 826360887089984268785983647159... |
| correct output |
|---|
| 73 |
| user output |
|---|
| (empty) |
Test 18
Verdict: RUNTIME ERROR
| input |
|---|
| 224396467462996787526747118066... |
| correct output |
|---|
| 66 |
| user output |
|---|
| (empty) |
Test 19
Verdict: RUNTIME ERROR
| input |
|---|
| 162181307721411363866352372656... |
| correct output |
|---|
| 70 |
| user output |
|---|
| (empty) |
Test 20
Verdict: RUNTIME ERROR
| input |
|---|
| 885185290760073270713376396959... |
| correct output |
|---|
| 73 |
| user output |
|---|
| (empty) |
