#include using namespace std; typedef long long ll; typedef pair pii; int n; stack st; int outs[100005]; int main(){ cin >> n; for(int i = 0;i > nowHei; while(!st.empty() && st.top().first < nowHei){ outs[st.top().second] = i + 1; st.pop(); } st.push({nowHei , i}); } while(!st.empty()){ outs[st.top().second] = 0; st.pop(); } for(int i = 0;i < n;i++) cout
#include #include #include #include #include using namespace std; typedef long long ll; ll arr[1505]; int main(){ cin.tie(0); cout.tie(0); priority_queue pq; pq.push(1); int ah = 1; set ins; while(ins.size() < 1500) { // cout
#include using namespace std; long long n; long long factory(long long num){ if(num == 0) return 1ll; if(num == 1) { cout
#include int main(){ int n , m; scanf("%d %d" , &n , &m); for(int i = 0;i < n;i++){ for(int j = 1;j
#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long ull; typedef pair pii; typedef signed char i8; typedef short i16; typedef int i32; typedef long long i64; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int p; int likeBeer[1005]; int dp[1005][1005]; bool used[1005]; int main() {..
#include int main(){ while(1){ int a , b; scanf("%d %d" , &a , &b); if(a 9 || b 9) { printf("INPUT ERROR!\n"); continue; } if(a < b){ for(int i = 1;i
#include using namespace std; int main(){ int n , dou = 1 , ans = 0; cin >> n; string s = to_string(n); for(int i = s.size() - 1;i >= 0;i--){ ans += dou * (s[i] - '0'); dou *= 2; } if(s.size() == 8){ ans -= dou / 2 * (s[0] - '0'); if(s[0] == '1'){ ans = ans - 128; } } cout
#include using namespace std; typedef unsigned long long ll; typedef pair pii; ll n , ans = 1; int main(){ cin.tie(0); cout.tie(0); cin >> n; ll low = 1 , high = n , mid; while(low mid){ low = mid + 1; } else { high = mid - 1; } } if(n < mid * mid){ mid--; } cout
#include using namespace std; typedef unsigned long long ll; typedef pair pii; // 행 : 세로 // 열 : 가로 int a, b, c, d, e = 0; vector f; bool g[1000005] = { 0, }; bool able(int wd) { int usedColorPaper = 0; int lastCover = -1; for (auto now : f) { if (usedColorPaper > c) return false; if (now c) return false; return true; } int main() { cin.tie(0); cout.tie(0); cin >> a >> b >> c >> d; for (int i = 0..