# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
473819 |
2021-09-16T09:47:55 Z |
Mr_Ph |
Crtanje (COCI20_crtanje) |
C++14 |
|
1 ms |
460 KB |
///made by : Mr_Ph :D
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
const double PI=acos(-1.0);
const ll mod=(ll)1e9+7;
//int dx[4] = {0, 0, 1, -1};
//int dy[4] = {1, -1, 0, 0};
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
///the end of the defines ;)
void solve()
{
int n;
cin>>n;
string s;
cin>>s;
vector<vector<char>>arr(400,vector<char>(400));
for(int i=0; i<400; i++)
for(int k=0; k<400; k++)
arr[i][k]='.';
int x=200,y=0;
int n1=0,n2=INT_MAX;
for(int i=0; i<s.sz; i++)
{
if(s[i]=='+')
{
arr[x][y]='/';
//x--;
}
else if(s[i]=='-')
{
arr[x][y]='\\';
//x++;
}
else
arr[x][y]='_';
n1=max(n1,x);
n2=min(n2,x);
//if(i+1<s.sz&&s[i]!=s[i+1])
//{
// y++;
// continue;
// }
if(i+1<s.sz&&s[i]=='+'&&s[i+1]=='-')
{
y++;
continue;
}
if(i+1<s.sz&&s[i]=='='&&s[i+1]=='+')
{
y++;
continue;
}
if(i+1<s.sz&&s[i]=='-'&&s[i+1]=='=')
{
y++;
continue;
}
if(i+1<s.sz&&s[i]=='-'&&s[i+1]=='+')
{
y++;
continue;
}
if(arr[x][y]=='/')
x--;
else if(arr[x][y]=='\\')
x++;
y++;
}
for(int i=n2; i<=n1; i++)
{
for(int k=0; k<n; k++)
cout<<arr[i][k];
cout<<endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
//freopen("window.in","r",stdin);
//freopen("output.txt","w",stdout);
int t=1;//int st;
//cin>>t;//cin>>st;
while(t--)
solve();
}
Compilation message
crtanje.cpp: In function 'void solve()':
crtanje.cpp:35:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | for(int i=0; i<s.sz; i++)
| ^
crtanje.cpp:56:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | if(i+1<s.sz&&s[i]=='+'&&s[i+1]=='-')
| ^
crtanje.cpp:61:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
61 | if(i+1<s.sz&&s[i]=='='&&s[i+1]=='+')
| ^
crtanje.cpp:66:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
66 | if(i+1<s.sz&&s[i]=='-'&&s[i+1]=='=')
| ^
crtanje.cpp:71:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
71 | if(i+1<s.sz&&s[i]=='-'&&s[i+1]=='+')
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
5 |
Correct |
1 ms |
460 KB |
Output is correct |