Submission #914893

#TimeUsernameProblemLanguageResultExecution timeMemory
914893vjudge1Patkice (COCI20_patkice)C++17
50 / 50
1 ms600 KiB
#include <iostream> #include <iomanip> #include <string> #include <math.h> #include <algorithm> #include <cstring> #include <numeric> #include <vector> #include <bitset> #include <map> #include <set> #include <queue> #include <deque> #include <unordered_map> #include <unordered_set> using namespace std; typedef long long ll; #define inf 1e10 #define sz(v) (ll)v.size() #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define dbg(x) cerr<<#x<<": "<<x<<"\n"; #define fr(i, x) for(ll i=0 ; i<x ; i++) #define fra(x, v) for(auto x:v) #define fra1(x,v) for(auto &x:v) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define pb(x) push_back(x) #define pll pair<ll, ll> #define vll vector<ll> #define mk(a, b) make_pair(a, b) #define F first #define S second /* const long long maxN=0; que es eso?? un maxN con 0 que pront bueno muchachos a dormir */ const double PI=acos(-1); const ll MOD=1e9+7; ll binpow(ll a, ll b){ ll cc=1; while(b){ if(b&1) cc*=a; a*=a; b>>=1; } return cc; } ll binpow1(ll a, ll b, ll uwu){ ll cc=1; while(b){ if(b&1) cc=cc*a%uwu; a=a*a%uwu; b>>=1; } return cc%uwu; } ll log2uwu(ll n){ fr(i, n+1){ if((1<<i) > n) return i-1; } return -1; } bool comp(string a, string b){ if(a.size()==b.size()){ fr(i, a.size()){ if(a[i]>b[i]) return 1; else if(a[i]<b[i]) return 0; } return 0; }else{ return a.size()>b.size(); } } ll isCousin(ll x){ for(ll i=2 ; i*i <= x ; i++){ if(!(x%i)) return i; } return 0; } ll webos(ll x){ fr(i, x){ if(i*i>x) return i-1; } return -1; } bool ok(ll mid, vll v, ll n, ll k){ ll cc=1, sum=0; fra(x, v){ if(x>mid) return false; sum+=x; if(sum>mid){ sum=x; cc++; } } if(cc<=k) return true; else return false; } ll xdxd(ll x){ fr(i, x+1){ if(i==0) continue; //dbg(i*i*i); if(i*i*i == x) return i; else if(i*i*i > x) return -1; } return -1; } ll tilin(ll v, ll k, ll n){ ll cc=v; for(ll i=1 ; i<n ; i++){ ll pro=v/pow(k, i); if(pro>0)cc+=pro; if(cc>=n || pro<=0){ return cc; } } return cc; } struct point{ ll x, y, z; }; const ll maxN=110; char lab[maxN][maxN]; ll n, m, aux=0; ll webos1(ll i, ll j, ll cc){ if(i==-1 || j==-1 || i==n || j==m || lab[i][j]=='.' || lab[i][j]=='o') return -1; if(lab[i][j]=='>') return webos1(i, j+1, cc+1); if(lab[i][j]=='<') return webos1(i, j-1, cc+1); if(lab[i][j]=='^') return webos1(i-1, j, cc+1); if(lab[i][j]=='v') return webos1(i+1, j, cc+1); if(lab[i][j]=='x') return cc; return 0; } void solve(){ cin>>n>>m; ll x=0, y=0; fr(i, n){ fr(j, m){ cin>>lab[i][j]; if(lab[i][j]=='o'){ x=i; y=j; } } } ll aux=webos1(x-1, y, 1); vector<pair<ll, char>>vp; if(aux>0){ vp.pb(mk(aux, 'N')); } aux=webos1(x+1, y, 1); if(aux>0){ vp.pb(mk(aux, 'S')); } aux=webos1(x, y-1, 1); if(aux>0){ vp.pb(mk(aux, 'W')); } aux=webos1(x, y+1, 1); if(aux>0){ vp.pb(mk(aux, 'E')); } if(vp.size()){ sort(all(vp)); cout<<":)\n"<<vp[0].S<<"\n"; }else cout<<":(\n"; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; }

Compilation message (stderr)

patkice.cpp: In function 'bool comp(std::string, std::string)':
patkice.cpp:22:32: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 | #define fr(i, x) for(ll i=0 ; i<x ; i++)
......
   75 |         fr(i, a.size()){
      |            ~~~~~~~~~~~          
patkice.cpp:75:9: note: in expansion of macro 'fr'
   75 |         fr(i, a.size()){
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...