Submission #64075758
Source Code Expand
Copy
// Author: Gourav Preet Gupta// Language: C++#include <bits/stdc++.h>using namespace std;#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);#define endl "\n"#define Max(x,y,z) max(x,max(y,z))#define Min(x,y,z) min(x,min(y,z))#define pb push_back#define ppb pop_back#define eb emplace_back#define mp make_pair#define float long double#define yes cout << "YES" << endl;#define no cout << "NO" << endl;#define sz(x) ((int)(x).size())#define all(x) (x).begin(), (x).end()#define PI 3.141592653589793#define Mod 1000000007
// Author: Gourav Preet Gupta // Language: C++ #include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define Max(x,y,z) max(x,max(y,z)) #define Min(x,y,z) min(x,min(y,z)) #define pb push_back #define ppb pop_back #define eb emplace_back #define mp make_pair #define float long double #define yes cout << "YES" << endl; #define no cout << "NO" << endl; #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define PI 3.141592653589793 #define Mod 1000000007 typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<long long> vll; typedef vector<vll> vvll; typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<pair<int,int> > vpii; typedef vector<pair<long long,long long> > vpll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef priority_queue<ll> pq; typedef priority_queue<pair<ll,ll> > pqp; template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; } /* ****************************************LOVE YOU MAA*************************************************** **********************************FAMILY ABOVE ALL***************************************************** **************************************GIVE ME SOME SUNSHINE , GIVE ME SOME RAIN************************ ******************************GIVE ME ANOTHER CHANCE , I WANNA GROW UP ONCE AGAIN********************** **************************************YE DIL MAANGE MORE*********************************************** **************************SHAURYAM DAKSHAM YUDDHE,BALIDAAN PARAM DHARMA******************************** */ // Never Stop Trying. // Trying to be Better than Myself. // while(true) // { // if(AC) // { // break; // } // else if(Contest Over) // { // Try. // Check out Editorial. // Understand. // Find out your Mistake. // Learn the topic (if new). // Solve Problems on that topic (if new). // Upsolve that problem. // break; // } // else // { // Try. // Use Pen-Paper. // Find errors, edge cases, etc. // continue; // } // } //Remember,mazaa journey mein jyaada hai,manzil main utna nahi.... const int N=1e5+5; void solve() { ll n,R,C; cin>>n>>R>>C; string s; cin>>s; set<pair<ll,ll> > st; st.insert({0,0}); ll cnt = 0; string ans = ""; for(ll i=0; i<n; i++) ans += '0'; for(ll i=0; i<n; i++) { set<pair<ll,ll> > st1; for(auto &[r,c] : st) { if(s[i] == 'N') st1.insert({r-1,c}); else if(s[i] == 'W') st1.insert({r,c-1}); else if(s[i] == 'S') st1.insert({r+1,c}); else st1.insert({r,c+1}); } if(st1.find({R,C}) != st1.end()) ans[i] = '1'; if(st1.find({0,0}) == st1.end()) st1.insert({0,0}); st = st1; } cout<<ans<<endl; } int main() { IOS; ll t=1; // cin>>t; while(t--) { solve(); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Bonfire |
User | gourav100110 |
Language | C++ 17 (gcc 12.2) |
Score | 0 |
Code Size | 3537 Byte |
Status | TLE |
Exec Time | 2210 ms |
Memory | 4752 KB |
Compile Error
Main.cpp: In function ‘void solve()’: Main.cpp:94:8: warning: unused variable ‘cnt’ [-Wunused-variable] 94 | ll cnt = 0; | ^~~
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 425 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 3520 KB |
sample_02.txt | AC | 1 ms | 3440 KB |
sample_03.txt | AC | 1 ms | 3516 KB |
test_01.txt | TLE | 2207 ms | 4112 KB |
test_02.txt | TLE | 2207 ms | 4112 KB |
test_03.txt | TLE | 2207 ms | 4132 KB |
test_04.txt | AC | 1 ms | 3500 KB |
test_05.txt | TLE | 2207 ms | 4204 KB |
test_06.txt | TLE | 2207 ms | 4228 KB |
test_07.txt | TLE | 2207 ms | 4228 KB |
test_08.txt | AC | 1 ms | 3636 KB |
test_09.txt | TLE | 2207 ms | 4096 KB |
test_10.txt | TLE | 2207 ms | 4056 KB |
test_11.txt | TLE | 2207 ms | 4112 KB |
test_12.txt | AC | 2 ms | 3528 KB |
test_13.txt | TLE | 2210 ms | 4124 KB |
test_14.txt | TLE | 2207 ms | 4164 KB |
test_15.txt | TLE | 2207 ms | 4200 KB |
test_16.txt | AC | 219 ms | 3604 KB |
test_17.txt | TLE | 2207 ms | 4156 KB |
test_18.txt | TLE | 2207 ms | 3996 KB |
test_19.txt | TLE | 2207 ms | 4012 KB |
test_20.txt | TLE | 2207 ms | 3884 KB |
test_21.txt | TLE | 2207 ms | 4140 KB |
test_22.txt | TLE | 2207 ms | 4068 KB |
test_23.txt | TLE | 2207 ms | 4220 KB |
test_24.txt | TLE | 2207 ms | 4164 KB |
test_25.txt | TLE | 2207 ms | 4576 KB |
test_26.txt | TLE | 2207 ms | 4704 KB |
test_27.txt | TLE | 2207 ms | 4672 KB |
test_28.txt | TLE | 2207 ms | 4668 KB |
test_29.txt | TLE | 2207 ms | 4688 KB |
test_30.txt | TLE | 2207 ms | 4592 KB |
test_31.txt | TLE | 2207 ms | 4716 KB |
test_32.txt | TLE | 2207 ms | 4620 KB |
test_33.txt | TLE | 2207 ms | 4688 KB |
test_34.txt | TLE | 2207 ms | 4648 KB |
test_35.txt | TLE | 2207 ms | 4748 KB |
test_36.txt | TLE | 2207 ms | 4752 KB |
test_37.txt | TLE | 2207 ms | 4632 KB |
test_38.txt | TLE | 2207 ms | 4652 KB |
test_39.txt | TLE | 2207 ms | 4620 KB |
test_40.txt | TLE | 2207 ms | 4544 KB |
test_41.txt | TLE | 2207 ms | 4224 KB |
test_42.txt | TLE | 2207 ms | 4476 KB |
test_43.txt | TLE | 2207 ms | 4608 KB |
test_44.txt | TLE | 2207 ms | 4552 KB |
test_45.txt | TLE | 2207 ms | 4584 KB |
test_46.txt | TLE | 2207 ms | 4240 KB |
test_47.txt | TLE | 2207 ms | 4628 KB |
test_48.txt | TLE | 2207 ms | 4296 KB |
test_49.txt | TLE | 2207 ms | 4524 KB |
test_50.txt | TLE | 2207 ms | 4520 KB |
test_51.txt | TLE | 2207 ms | 4252 KB |
test_52.txt | TLE | 2210 ms | 4644 KB |
test_53.txt | TLE | 2207 ms | 4352 KB |
test_54.txt | TLE | 2207 ms | 4532 KB |
test_55.txt | TLE | 2207 ms | 4568 KB |
test_56.txt | TLE | 2210 ms | 4476 KB |
test_57.txt | TLE | 2207 ms | 4520 KB |
test_58.txt | TLE | 2207 ms | 4480 KB |
test_59.txt | TLE | 2207 ms | 4416 KB |
test_60.txt | TLE | 2207 ms | 4556 KB |