QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96219#2920. Ultimate Binary Watchmostafa_ayman#AC ✓2ms3456kbC++142.3kb2023-04-13 17:19:182023-04-13 17:19:20

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 17:19:20]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3456kb
  • [2023-04-13 17:19:18]
  • 提交

answer

#pragma GCC optimize ("O3")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define int ll
typedef tree<
        pair<int, int>,
        null_type,
        less<pair<int, int>>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;//order_of_key()->gives how many elements less than specific element in the set ,, find_by_order() ->find specific element by index the set
#define  ll long long
#define  el '\n'
#define IO       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

#define endl '\n'
using namespace std;

/*void test() {
    vector<int> tmp = {1,2,3,5};
     auto i = lower_bound(tmp.begin() + 1, tmp.end(),4);
     cout << *i << el;
}*/
signed main() {
    IO
    //freopen("i.txt", "r", stdin);
    //freopen("o.txt", "w", stdout);
    //string binary = bitset<30>(n).to_string();
    string s;
    cin>>s;
    char arr[4][5];
    arr[0][2]=' ';
    arr[1][2]=' ';
    arr[2][2]=' ';
    arr[3][2]=' ';
    for(int i=0;i<4;i++)
    {
        char x=s[i];
        int a=x-'0';
        string binary = bitset<4>(a).to_string();
       // reverse(binary.begin(),binary.end());
        //cout<<binary<<"\n";
        string ans="";
        for(int k=0;k<4;k++)
        {
            if(binary[k]=='1')
                ans+="*";
            else
                ans+=".";
        }
        if(i==0)
        {
            arr[0][0]=ans[0];
            arr[1][0]=ans[1];
            arr[2][0]=ans[2];
            arr[3][0]=ans[3];
        }
        else if(i==1)
        {
            arr[0][1]=ans[0];
            arr[1][1]=ans[1];
            arr[2][1]=ans[2];
            arr[3][1]=ans[3];
        }
        else if(i==2)
        {
            arr[0][3]=ans[0];
            arr[1][3]=ans[1];
            arr[2][3]=ans[2];
            arr[3][3]=ans[3];
        }
        else
        {
            arr[0][4]=ans[0];
            arr[1][4]=ans[1];
            arr[2][4]=ans[2];
            arr[3][4]=ans[3];
        }
    }
    for(int i=0;i<4;i++)
    {
        for(int j=0;j<5;j++)
        {
            cout<<arr[i][j]<<" ";
        }
        cout<<"\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3348kb

input:

1234

output:

. .   . . 
. .   . * 
. *   * . 
* .   * . 

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 2ms
memory: 3384kb

input:

0056

output:

. .   . . 
. .   * * 
. .   . * 
. .   * . 

result:

ok 4 lines

Test #3:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

0708

output:

. .   . * 
. *   . . 
. *   . . 
. *   . . 

result:

ok 4 lines

Test #4:

score: 0
Accepted
time: 2ms
memory: 3384kb

input:

0909

output:

. *   . * 
. .   . . 
. .   . . 
. *   . * 

result:

ok 4 lines

Test #5:

score: 0
Accepted
time: 2ms
memory: 3436kb

input:

0000

output:

. .   . . 
. .   . . 
. .   . . 
. .   . . 

result:

ok 4 lines

Test #6:

score: 0
Accepted
time: 1ms
memory: 3372kb

input:

0001

output:

. .   . . 
. .   . . 
. .   . . 
. .   . * 

result:

ok 4 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3344kb

input:

0100

output:

. .   . . 
. .   . . 
. .   . . 
. *   . . 

result:

ok 4 lines

Test #8:

score: 0
Accepted
time: 1ms
memory: 3344kb

input:

2300

output:

. .   . . 
. .   . . 
* *   . . 
. *   . . 

result:

ok 4 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

2359

output:

. .   . * 
. .   * . 
* *   . . 
. *   * * 

result:

ok 4 lines

Test #10:

score: 0
Accepted
time: 2ms
memory: 3348kb

input:

1757

output:

. .   . . 
. *   * * 
. *   . * 
* *   * * 

result:

ok 4 lines

Test #11:

score: 0
Accepted
time: 1ms
memory: 3456kb

input:

0959

output:

. *   . * 
. .   * . 
. .   . . 
. *   * * 

result:

ok 4 lines

Test #12:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

2007

output:

. .   . . 
. .   . * 
* .   . * 
. .   . * 

result:

ok 4 lines

Test #13:

score: 0
Accepted
time: 2ms
memory: 3428kb

input:

2244

output:

. .   . . 
. .   * * 
* *   . . 
. .   . . 

result:

ok 4 lines

Test #14:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

1939

output:

. *   . * 
. .   . . 
. .   * . 
* *   * * 

result:

ok 4 lines

Test #15:

score: 0
Accepted
time: 0ms
memory: 3340kb

input:

0117

output:

. .   . . 
. .   . * 
. .   . * 
. *   * * 

result:

ok 4 lines

Test #16:

score: 0
Accepted
time: 1ms
memory: 3352kb

input:

0220

output:

. .   . . 
. .   . . 
. *   * . 
. .   . . 

result:

ok 4 lines

Test #17:

score: 0
Accepted
time: 2ms
memory: 3344kb

input:

1354

output:

. .   . . 
. .   * * 
. *   . . 
* *   * . 

result:

ok 4 lines

Test #18:

score: 0
Accepted
time: 1ms
memory: 3348kb

input:

1201

output:

. .   . . 
. .   . . 
. *   . . 
* .   . * 

result:

ok 4 lines

Test #19:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

1902

output:

. *   . . 
. .   . . 
. .   . * 
* *   . . 

result:

ok 4 lines

Test #20:

score: 0
Accepted
time: 2ms
memory: 3448kb

input:

2229

output:

. .   . * 
. .   . . 
* *   * . 
. .   . * 

result:

ok 4 lines

Test #21:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

0749

output:

. .   . * 
. *   * . 
. *   . . 
. *   . * 

result:

ok 4 lines

Test #22:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

1957

output:

. *   . . 
. .   * * 
. .   . * 
* *   * * 

result:

ok 4 lines

Test #23:

score: 0
Accepted
time: 0ms
memory: 3376kb

input:

0019

output:

. .   . * 
. .   . . 
. .   . . 
. .   * * 

result:

ok 4 lines

Test #24:

score: 0
Accepted
time: 0ms
memory: 3356kb

input:

1127

output:

. .   . . 
. .   . * 
. .   * * 
* *   . * 

result:

ok 4 lines

Test #25:

score: 0
Accepted
time: 1ms
memory: 3428kb

input:

1502

output:

. .   . . 
. *   . . 
. .   . * 
* *   . . 

result:

ok 4 lines

Test #26:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

1615

output:

. .   . . 
. *   . * 
. *   . . 
* .   * * 

result:

ok 4 lines

Test #27:

score: 0
Accepted
time: 2ms
memory: 3348kb

input:

1900

output:

. *   . . 
. .   . . 
. .   . . 
* *   . . 

result:

ok 4 lines

Test #28:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

0830

output:

. *   . . 
. .   . . 
. .   * . 
. .   * . 

result:

ok 4 lines